Struct artichoke_backend::extn::core::random::Random[][src]

pub struct Random(_);

Implementations

Methods from Deref<Target = SpinosoRandom>

Generate next u32 output.

Generates a random number on (0..=0xffffffff)-interval.

u32 is the native output of the generator. This function advances the RNG step counter by one.

Examples
let mut random = Random::new()?;
assert_ne!(random.next_int32(), random.next_int32());

Generate next f64 output.

Generates a random number on [0,1) with 53-bit resolution.

Examples
let mut random = Random::new()?;
assert_ne!(random.next_real(), random.next_real());

Fill a buffer with bytes generated from the RNG.

This method generates random u32s (the native output unit of the RNG) until dest is filled.

This method may discard some output bits if dest.len() is not a multiple of 4.

Examples
let mut random = Random::new()?;
let mut buf = [0; 32];
random.fill_bytes(&mut buf);
assert_ne!([0; 32], buf);
let mut buf = [0; 31];
random.fill_bytes(&mut buf);
assert_ne!([0; 31], buf);

Returns the seed value used to initialize the generator.

This may be used to initialize another generator with the same state at a later time, causing it to produce the same sequence of numbers.

Examples
let seed = [1_u32, 2, 3, 4];
let random = Random::with_array_seed(seed);
assert_eq!(random.seed(), seed);

Trait Implementations

Performs the conversion.

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.