Generates rationals in [0, 1)
| 50 | |
| 51 | // Generates rationals in [0, 1) |
| 52 | float getFloat01(uint *val, uint index) { |
| 53 | // Conversion to floats adapted from Random123 |
| 54 | constexpr float factor = |
| 55 | ((1.0f) / |
| 56 | (static_cast<float>(std::numeric_limits<unsigned int>::max()) + |
| 57 | (1.0f))); |
| 58 | constexpr float half_factor = ((0.5f) * factor); |
| 59 | return fmaf(val[index], factor, half_factor); |
| 60 | } |
| 61 | |
| 62 | // Generates rationals in (-1, 1] |
| 63 | static float getFloatNegative11(uint *val, uint index) { |
no test coverage detected