Trait quasirandom::FromUniform
source ·
[−]pub trait FromUniform {
fn from_uniform(uniform_value: f64) -> Self;
}
Expand description
A type that implements FromUniform
is able to instantiate itself
from an f64
uniformly distributed in the range [0, 1)
.
For example, bool
maps values < 0.5 to false
and >= 0.5 to
true
, and u32
maps values evenly in 0..=u32::MAX
.
The mapping is less clear when it comes to more complicated enums,
such as Option
. In general, this is up to the judgment of the
implementer. Reasonable implementations are provided for many common
standard library types.
Required methods
fn from_uniform(uniform_value: f64) -> Self
Implementations on Foreign Types
The identity mapping
The identity mapping
Uniform in 0 .. = MAX
Uniform in 0 .. = MAX
Uniform in 0 .. = MAX
Uniform in 0 .. = MAX
Uniform in 0 .. = MAX
Uniform in 0 .. = MAX
Uniform in MIN ..= MAX
Uniform in MIN ..= MAX
Uniform in MIN ..= MAX
Uniform in MIN ..= MAX
Uniform in MIN ..= MAX
Uniform in MIN ..= MAX
50% delegate to Ok
, 50% to Err
50% delegate to Some
, 50% to None
50% false, 50% true