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

Function getDouble01

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

Generates rationals in [0, 1)

Source from the content-addressed store, hash-verified

90
91// Generates rationals in [0, 1)
92double getDouble01(uint *val, uint index) {
93 uintl v = transform<uintl>(val, index);
94 constexpr double factor =
95 ((1.0) / (std::numeric_limits<unsigned long long>::max() +
96 static_cast<long double>(1.0l)));
97 constexpr double half_factor((0.5) * factor);
98 return fma(v, factor, half_factor);
99}
100
101template<>
102char transform<char>(uint *val, uint index) {

Callers 2

transform<double>Function · 0.70
boxMullerTransformFunction · 0.70

Calls 2

fmaFunction · 0.85
maxFunction · 0.50

Tested by

no test coverage detected