Struct weird_data::Wdg
source · pub struct Wdg(/* private fields */);Expand description
A weird data generator
Implementations§
source§impl Wdg
impl Wdg
pub fn with_seed(seed: u64) -> Self
pub fn fork(&mut self) -> Self
pub fn seed(&mut self, seed: u64)
pub fn get_seed(&mut self) -> u64
sourcepub fn nan_f32(&mut self) -> f32
pub fn nan_f32(&mut self) -> f32
Generates a random f32 NAN value.
There are multiple bit patterns that are equivalent to a NAN.
This generator covers all possible NAN values as specified in
IEEE-754, even ones that Rust would normally not generate.
sourcepub fn nan_f64(&mut self) -> f64
pub fn nan_f64(&mut self) -> f64
Generates a random f64 NAN value.
There are multiple bit patterns that are equivalent to a NAN.
This generator covers all possible NAN values as specified in
IEEE-754, even ones that Rust would normally not generate.
sourcepub fn subnormal_f32(&mut self) -> f32
pub fn subnormal_f32(&mut self) -> f32
Generates a random f32 denormal value.
This generator covers all possible denormal values as specified in IEEE-754.
sourcepub fn subnormal_f64(&mut self) -> f64
pub fn subnormal_f64(&mut self) -> f64
Generates a random f64 denormal value.
This generator covers all possible denormal values as specified in IEEE-754.
sourcepub fn normal_f32(&mut self) -> f32
pub fn normal_f32(&mut self) -> f32
Generate a random f32 normal value
sourcepub fn normal_f64(&mut self) -> f64
pub fn normal_f64(&mut self) -> f64
Generate a random f64 normal value
sourcepub fn special_f32(&mut self) -> f32
pub fn special_f32(&mut self) -> f32
Generate a random f32 “special” value
A special value is what I call specific float values that are unique and are pretty much impossible to generate by chance, and have some unusual properties.
sourcepub fn special_f64(&mut self) -> f64
pub fn special_f64(&mut self) -> f64
Generate a random f64 “special” value
A special value is what I call specific float values that are unique and are pretty much impossible to generate by chance, and have some unusual properties.
sourcepub fn f32(&mut self) -> f32
pub fn f32(&mut self) -> f32
Generate a random f32, such that special or problematic values are much more common than normal.
The distribution is not statistically useful, but it ensures that all edge-case
values get a fair chance of being generated. This is better than using a regular
random number generator, because in the vast majority of cases, a random number
generator will generate perfectly regular and well-behaved values, and certain
values, like INFINITY and NAN may be impossible to generate.
The distribution is as follows:
- 25% normal values
- 25% subnormal values
- 25%
NANvalues, including all possible payloads, quiet and signalingNAN. - 25% “special” values, i.e. unique values with special properties such as
INFINITYand-0.0
sourcepub fn f64(&mut self) -> f64
pub fn f64(&mut self) -> f64
Generate a random f64, such that special or problematic values are much more common than normal.
The distribution is not statistically useful, but it ensures that all edge-case
values get a fair chance of being generated. This is better than using a regular
random number generator, because in the vast majority of cases, a random number
generator will generate perfectly regular and well-behaved values, and certain
values, like INFINITY and NAN may be impossible to generate.
The distribution is as follows:
- 25% normal values
- 25% subnormal values
- 25%
NANvalues, including all possible payloads, quiet and signalingNAN. - 25% “special” values, i.e. unique values with special properties such as
INFINITYand-0.0