Generates rationals in (0, 1]
| 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) { |
no test coverage detected