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

Function getFloatNegative11

src/backend/cpu/kernel/random_engine.hpp:63–71  ·  view source on GitHub ↗

Generates rationals in (-1, 1]

Source from the content-addressed store, hash-verified

61
62// Generates rationals in (-1, 1]
63static float getFloatNegative11(uint *val, uint index) {
64 // Conversion to floats adapted from Random123
65 constexpr float factor =
66 ((1.0) /
67 (static_cast<double>(std::numeric_limits<int>::max()) + (1.0)));
68 constexpr float half_factor = ((0.5f) * factor);
69
70 return fmaf(static_cast<float>(val[index]), factor, half_factor);
71}
72
73// Generates rationals in [0, 1)
74arrayfire::common::half getHalf01(uint *val, uint index) {

Callers 1

boxMullerTransformFunction · 0.70

Calls 1

maxFunction · 0.50

Tested by

no test coverage detected