MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / getFloatNegative11

Function getFloatNegative11

src/backend/cuda/kernel/random_engine.hpp:122–130  ·  view source on GitHub ↗

Generates rationals in (-1, 1]

Source from the content-addressed store, hash-verified

120
121// Generates rationals in (-1, 1]
122__device__ static float getFloatNegative11(uint num) {
123 // Conversion to floats adapted from Random123
124 constexpr float factor =
125 ((1.0) /
126 (static_cast<double>(std::numeric_limits<int>::max()) + (1.0)));
127 constexpr float half_factor = ((0.5f) * factor);
128
129 return fmaf(static_cast<float>(num), factor, half_factor);
130}
131
132// Generates rationals in (0, 1]
133__device__ static double getDouble01(uint num1, uint num2) {

Callers 2

Calls 1

maxFunction · 0.50

Tested by

no test coverage detected