pub trait Unif01Ext {
// Required method
fn unif_01(&mut self) -> f64;
}Expand description
Extension trait adding a unif_01 method to every generator
implementing rand_core::Rng (in particular, to the generators of the
rand crate).
Required Methods§
Sourcefn unif_01(&mut self) -> f64
fn unif_01(&mut self) -> f64
Returns a random f64 distributed as a uniform real in [0 . . 1)
rounded down to the nearest representable value: every float in
[0 . . 1) is reachable, subnormals and 0 included, with probability
equal to the measure of the reals that round down to it.
This is f64_full applied to the generator.
§Examples
use rand_float::uniform::Unif01Ext;
let x = rand::rng().unif_01();
assert!((0.0..1.0).contains(&x));Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".