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

Function getFloat01

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

Generates rationals in (0, 1]

Source from the content-addressed store, hash-verified

108
109// Generates rationals in (0, 1]
110__device__ static float getFloat01(uint num) {
111 // Conversion to floats adapted from Random123
112 constexpr float factor =
113 ((1.0f) /
114 (static_cast<float>(std::numeric_limits<unsigned int>::max()) +
115 (1.0f)));
116 constexpr float half_factor = ((0.5f) * factor);
117
118 return fmaf(static_cast<float>(num), factor, half_factor);
119}
120
121// Generates rationals in (-1, 1]
122__device__ static float getFloatNegative11(uint num) {

Callers 4

writeOut128BytesFunction · 0.70
partialWriteOut128BytesFunction · 0.70

Calls 1

maxFunction · 0.50

Tested by

no test coverage detected