nextFloat method
Generates a random floating point value uniformly distributed in the range from 0.0, inclusive, to 1.0, exclusive.
This method works faster than nextDouble. It sacrifices accuracy for speed. The result is mapped from a single 32-bit integer to double. Therefore, the variability is limited by the number of possible values of such integer: 2^32 (= 4 294 967 296).
This method uses the conversion suggested by J. Doornik in "Conversion of high-period random numbers to floating point" (2005).
Implementation
double nextFloat() {
// https://www.doornik.com/research/randomdouble.pdf
const M_RAN_INVM32 = 2.32830643653869628906e-010;
return nextRaw32().uint32_to_int32() * M_RAN_INVM32 + 0.5;
}