[][src]Struct randomize::PCG32

pub struct PCG32 {
    pub state: u64,
    pub inc: u64,
}

A permuted congruential generator with 32-bit output. Pick this by default.

Fields

state: u64

State value. Changes with every use.

inc: u64

Inc value. Selects the output stream ordering.

This doesn't change as the generator is used. You just set it and forget it. If this value isn't odd, your generator won't have a full period before it loops. The seed constructor will ensure that the inc value is set to be odd, but the From constructors will not.

Methods

impl PCG32[src]

pub const fn seed(seed: u64, inc: u64) -> Self[src]

Crates a generator from the seed and inc given.

The precise seeding details are not considered a "stable" part of the API.

If you wish to exactly create a generator using particular state and inc values then use the From impl.

pub fn next_u32(&mut self) -> u32[src]

Runs the generator once and gets a u32 as output.

pub fn fill_bytes(&mut self, bytes: &mut [u8])[src]

Fill a mutable byte slice from this generator.

pub fn jump(&mut self, delta: u64)[src]

Advances the generator delta steps in log(delta) time.

Trait Implementations

impl From<[u64; 2]> for PCG32[src]

fn from(value: [u64; 2]) -> Self[src]

Uses the provided values exactly.

impl From<(u64, u64)> for PCG32[src]

fn from(value: (u64, u64)) -> Self[src]

Uses the provided values exactly.

impl From<PCG32> for [u64; 2][src]

impl From<PCG32> for (u64, u64)[src]

impl PartialEq<PCG32> for PCG32[src]

impl Eq for PCG32[src]

impl Hash for PCG32[src]

impl Debug for PCG32[src]

impl Clone for PCG32[src]

impl Default for PCG32[src]

Auto Trait Implementations

impl Unpin for PCG32

impl Send for PCG32

impl Sync for PCG32

Blanket Implementations

impl<T> From<T> for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

The type returned in the event of a conversion error.

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

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

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