[][src]Struct dicetest::prand::Prng

pub struct Prng { /* fields omitted */ }

A pseudorandom number generator.

The algorithms are based on this article by Bob Jenkins.

Methods

impl Prng
[src]

pub fn from_seed(seed: Seed) -> Prng
[src]

Creates a Prng whose internal state is initialized with the given seed.

The result has a satisfying cycle length.

pub fn from_bytes(state_bytes: [u8; 32]) -> Prng
[src]

Creates a Prng using the given byte array as internal state.

This function is a left and right inverse for Prng::to_bytes.

A satisfying cycle length is only guaranteed for bytes from Prng::to_bytes called with an Prng that has a satisfying cycle length. Other bytes should not be passed to this function. For initializing an Prng with an arbitrary seed, use Prng::from_seed instead.

pub fn to_bytes(&self) -> [u8; 32]
[src]

Returns the internal state as a byte array.

This function is a left and right inverse for Prng::from_bytes.

pub fn next_number(&mut self) -> u64
[src]

Returns the next pseudorandom number.

pub fn reseed(&mut self, seed: Seed)
[src]

Reinitialze the internal state of self using the current internal state and the given seed.

pub fn fork(&mut self) -> Prng
[src]

Splits off a new Prng from self. The internal state of the new Prng is generated with self.

Trait Implementations

impl Eq for Prng
[src]

impl Clone for Prng
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq<Prng> for Prng
[src]

impl Debug for Prng
[src]

impl BuildHasher for Prng
[src]

type Hasher = SipHasher

Type of the hasher that will be created.

Auto Trait Implementations

impl Send for Prng

impl Sync for Prng

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

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

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

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

The type returned in the event of a conversion error.