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
Sourcepub fn special_u8(&mut self) -> u8
pub fn special_u8(&mut self) -> u8
Generate a random u8 “special” value
A special value is what I call specific values that are unique and are pretty much impossible to generate by chance, and have some unusual properties.
pub fn u8(&mut self) -> u8
Sourcepub fn special_u16(&mut self) -> u16
pub fn special_u16(&mut self) -> u16
Generate a random u16 “special” value
A special value is what I call specific values that are unique and are pretty much impossible to generate by chance, and have some unusual properties.
pub fn u16(&mut self) -> u16
Sourcepub fn special_u32(&mut self) -> u32
pub fn special_u32(&mut self) -> u32
Generate a random u32 “special” value
A special value is what I call specific values that are unique and are pretty much impossible to generate by chance, and have some unusual properties.
pub fn u32(&mut self) -> u32
Sourcepub fn special_u64(&mut self) -> u64
pub fn special_u64(&mut self) -> u64
Generate a random u64 “special” value
A special value is what I call specific values that are unique and are pretty much impossible to generate by chance, and have some unusual properties.
pub fn u64(&mut self) -> u64
Sourcepub fn special_u128(&mut self) -> u128
pub fn special_u128(&mut self) -> u128
Generate a random u128 “special” value
A special value is what I call specific values that are unique and are pretty much impossible to generate by chance, and have some unusual properties.
pub fn u128(&mut self) -> u128
Sourcepub fn special_usize(&mut self) -> usize
pub fn special_usize(&mut self) -> usize
Generate a random usize “special” value
A special value is what I call specific values that are unique and are pretty much impossible to generate by chance, and have some unusual properties.
pub fn usize(&mut self) -> usize
Sourcepub fn special_i8(&mut self) -> i8
pub fn special_i8(&mut self) -> i8
Generate a random i8 “special” value
A special value is what I call specific values that are unique and
are pretty much impossible to generate by chance, and have some unusual
properties. For instance MAX and 0.
Sourcepub fn i8(&mut self) -> i8
pub fn i8(&mut self) -> i8
Generate a random i8 , such that special or problematic values are much more common than normal.
Sourcepub fn special_i16(&mut self) -> i16
pub fn special_i16(&mut self) -> i16
Generate a random i16 “special” value
A special value is what I call specific values that are unique and
are pretty much impossible to generate by chance, and have some unusual
properties. For instance MAX and 0.
Sourcepub fn i16(&mut self) -> i16
pub fn i16(&mut self) -> i16
Generate a random i16 , such that special or problematic values are much more common than normal.
Sourcepub fn special_i32(&mut self) -> i32
pub fn special_i32(&mut self) -> i32
Generate a random i32 “special” value
A special value is what I call specific values that are unique and
are pretty much impossible to generate by chance, and have some unusual
properties. For instance MAX and 0.
Sourcepub fn i32(&mut self) -> i32
pub fn i32(&mut self) -> i32
Generate a random i32 , such that special or problematic values are much more common than normal.
Sourcepub fn special_i64(&mut self) -> i64
pub fn special_i64(&mut self) -> i64
Generate a random i64 “special” value
A special value is what I call specific values that are unique and
are pretty much impossible to generate by chance, and have some unusual
properties. For instance MAX and 0.
Sourcepub fn i64(&mut self) -> i64
pub fn i64(&mut self) -> i64
Generate a random i64 , such that special or problematic values are much more common than normal.
Sourcepub fn special_i128(&mut self) -> i128
pub fn special_i128(&mut self) -> i128
Generate a random i128 “special” value
A special value is what I call specific values that are unique and
are pretty much impossible to generate by chance, and have some unusual
properties. For instance MAX and 0.
Sourcepub fn i128(&mut self) -> i128
pub fn i128(&mut self) -> i128
Generate a random i128 , such that special or problematic values are much more common than normal.
Sourcepub fn special_isize(&mut self) -> isize
pub fn special_isize(&mut self) -> isize
Generate a random isize “special” value
A special value is what I call specific values that are unique and
are pretty much impossible to generate by chance, and have some unusual
properties. For instance MAX and 0.