mozilla/rust — pull request #2939 by jld (2012-07-17 05:02:07+00:00)
Title: Prevent random floats from occasionally being greater than 1.

Previously, gen_f64 could generate numbers as high as 1.0000000002328306
in the case that u3 was 4294967295.0f64 and u2 was nonzero. This change
divides the random numbers by 2**32 instead, effectively concatenating
their bits as apparently intended. (Bonus fix: const.)

The comments are updated to be more specific than "random float"; note
that this can still generate 1.0f64 (P = 2**-54) due to rounding.

See also: https://gist.github.com/3127268