13 ms·
I'm not really familiar with the larger issue, but the scaling method is easy as long as you have an easy way of producing a uniformly distributed random value
by thaumasiotes 4y ago
I'm not really familiar with the larger issue, but the scaling method is easy as long as you have an easy way of producing a uniformly distributed random value between 0 and 1.
That's not so easy to do; I suspect the fancier methods of generating random numbers are of interest because they have an easier requirement such as "32 random bits".
- hinkley 4y agoI've not looked at implementation details for long enough that I don't trust my answer, but I presume it has something to do with getting 30-some bits of data from the RNG, then coercing it to a floating point with zero on the left side of the mantissa.
- Dylan16807 4y ago> I'm not really familiar with the larger issue, but the scaling method is easy as long as you have an easy way of producing a uniformly distributed random value between 0 and 1. That's not so easy to do It's plenty easy to do. Start with 1.0 then fill the mantissa with random bits. For a flat distribution subtract 1.0. For an "every float is possible" distribution count the leading 0 bits in another chunk of random, and subtract count+1 from the exponent. You'd probably want the former for a situation like this.