[][src]Struct randomize::PCG64

pub struct PCG64 {
    pub state: u128,
    pub inc: u128,
}

A permuted congruential generator with 64-bit output. Pick this if you want to do stuff with f64 values.

Fields

state: u128

State value. Changes with every use.

inc: u128

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 PCG64[src]

pub const fn seed(seed: u128, inc: u128) -> 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_u64(&mut self) -> u64[src]

Runs the generator once and gets a u64 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: u128)[src]

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

Trait Implementations

impl From<[u128; 2]> for PCG64[src]

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

Uses the provided values exactly.

impl From<(u128, u128)> for PCG64[src]

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

Uses the provided values exactly.

impl From<PCG64> for [u128; 2][src]

impl From<PCG64> for (u128, u128)[src]

impl PartialEq<PCG64> for PCG64[src]

impl Eq for PCG64[src]

impl Hash for PCG64[src]

impl Debug for PCG64[src]

impl Clone for PCG64[src]

impl Default for PCG64[src]

Auto Trait Implementations

impl Unpin for PCG64

impl Send for PCG64

impl Sync for PCG64

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]