Wdg

Struct Wdg 

Source
pub struct Wdg(/* private fields */);
Expand description

A weird data generator

Implementations§

Source§

impl Wdg

Source

pub fn new() -> Self

Create a new Wdg by forking the global Wdg.

If you want to control the initial seed, use [with_seed] instead.

Source§

impl Wdg

Source

pub fn with_seed(seed: u64) -> Self

Source

pub fn fork(&mut self) -> Self

Source

pub fn seed(&mut self, seed: u64)

Source

pub fn get_seed(&mut self) -> u64

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn normal_f32(&mut self) -> f32

Generate a random f32 normal value

Source

pub fn normal_f64(&mut self) -> f64

Generate a random f64 normal value

Source

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.

Source

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.

Source

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% NAN values, including all possible payloads, quiet and signaling NAN.
  • 25% “special” values, i.e. unique values with special properties such as INFINITY and -0.0
Source

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% NAN values, including all possible payloads, quiet and signaling NAN.
  • 25% “special” values, i.e. unique values with special properties such as INFINITY and -0.0
Source

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.

Source

pub fn u8(&mut self) -> u8

Source

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.

Source

pub fn u16(&mut self) -> u16

Source

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.

Source

pub fn u32(&mut self) -> u32

Source

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.

Source

pub fn u64(&mut self) -> u64

Source

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.

Source

pub fn u128(&mut self) -> u128

Source

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.

Source

pub fn usize(&mut self) -> usize

Source

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.

Source

pub fn i8(&mut self) -> i8

Generate a random i8 , such that special or problematic values are much more common than normal.

Source

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.

Source

pub fn i16(&mut self) -> i16

Generate a random i16 , such that special or problematic values are much more common than normal.

Source

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.

Source

pub fn i32(&mut self) -> i32

Generate a random i32 , such that special or problematic values are much more common than normal.

Source

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.

Source

pub fn i64(&mut self) -> i64

Generate a random i64 , such that special or problematic values are much more common than normal.

Source

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.

Source

pub fn i128(&mut self) -> i128

Generate a random i128 , such that special or problematic values are much more common than normal.

Source

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.

Source

pub fn isize(&mut self) -> isize

Generate a random isize , such that special or problematic values are much more common than normal.

Trait Implementations§

Source§

impl Clone for Wdg

Source§

fn clone(&self) -> Wdg

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Wdg

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Wdg

§

impl RefUnwindSafe for Wdg

§

impl Send for Wdg

§

impl Sync for Wdg

§

impl Unpin for Wdg

§

impl UnwindSafe for Wdg

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.