pub fn f64_down(bits: impl FnMut() -> u64) -> f64Expand description
Returns a random f64 distributed as a uniform real in (0 . . 1) rounded
down (toward −∞) to the nearest representable value.
The result lies in [0 . . 1); every f64 in that range, including every
subnormal and 0, is returned with probability equal to the measure of
the reals that round down to it. See the module documentation for
the algorithm.
bits must return independent uniform random 64-bit words. Exactly one
word is consumed with probability ≈ 1 − 2⁻¹²; the expected number of
words per call is 1 + 2⁻¹² + O(2⁻⁵²).
To call it repeatedly on the same source, pass the source by mutable reference:
// A Weyl sequence: statistically very poor, for illustration only.
let mut src = rand_float::sources::Weyl(1);
let mut next = || src.next_u64();
let x = rand_float::badizadegan::f64_down(&mut next);
let y = rand_float::badizadegan::f64_down(&mut next);
assert!(x != y);