8 ms·
This is a widely used method to map random integers to floating point numbers, but it has the disadvantage of wasting 1 bit of float mantissa precision. On mod
by binarycoffee 4y ago
This is a widely used method to map random integers to floating point numbers, but it has the disadvantage of wasting 1 bit of float mantissa precision.
On modern CPUs, its computational advantage over full-precision mapping methods, such as multiplication by a float, is not always clear [1].
[1] https://github.com/rust-random/rand/issues/416 https://github.com/rust-random/rand/issues/416