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

Function getFloat01

src/backend/oneapi/kernel/random_engine_write.hpp:18–27  ·  view source on GitHub ↗

Generates rationals in (0, 1]

Source from the content-addressed store, hash-verified

16
17// Generates rationals in (0, 1]
18static float getFloat01(uint num) {
19 // Conversion to floats adapted from Random123
20 constexpr float factor =
21 ((1.0f) /
22 (static_cast<float>(std::numeric_limits<unsigned int>::max()) +
23 (1.0f)));
24 constexpr float half_factor = ((0.5f) * factor);
25
26 return sycl::fma(static_cast<float>(num), factor, half_factor);
27}
28
29// Generates rationals in (-1, 1]
30static float getFloatNegative11(uint num) {

Callers 4

writeOut128BytesFunction · 0.70
partialWriteOut128BytesFunction · 0.70

Calls 2

fmaFunction · 0.85
maxFunction · 0.50

Tested by

no test coverage detected