Struct tiamat::Pcg[][src]

pub struct Pcg { /* fields omitted */ }

A Permuted Congruential Generator.

Permuted congruential generators (PCGs) are linear congruential generators that, instead of using their state as the random number, permute their state. This improves their statistical quality significantly, while maintaining quite fast performance; they are however not cryptographically secure.

The main interface for this struct are its Rng and SeedableRng implementations. In addition, Pcg also provides functions for advancing and reversing itself by an arbitrary amount of steps quickly.

Pcg provides for 263 different sequences, these are specified by the second field of the seed (see reseed's documentation). It implements the "xsh-rr-64-32" scheme.

For more information on PCGs, see pcgrandom.org.

Methods

impl Pcg
[src]

Creates the Pcg with a given seed and sequence.

The highest bit of sequence is ignored.

Advances the Pcg by delta steps.

This uses a method similar to fast exponentiation and thus runs in O(log(delta)) time.

Reverses the Pcg by delta steps.

This is a convenience method, reversing by delta steps is the same as advancing by 264-delta steps.

Calculates the distance between Pcgs of the same sequence.

Errors

If self and other are on different streams, this method returns None.

Trait Implementations

impl Debug for Pcg
[src]

Formats the value using the given formatter. Read more

impl Clone for Pcg
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Pcg
[src]

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

This method tests for !=.

impl Eq for Pcg
[src]

impl RandomGen for Pcg
[src]

Returns a (pseudo-)random, uniformly distributed u32. Read more

Generates a random value. Read more

Generates a random value according to some specification. Read more

Chooses a random element from the slice, where each element has the same probability of being chosen. Read more

Important traits for IterGen<'a, G, R>

Returns an iterator over randomly generated values. Read more

Important traits for IterBuild<'a, G, B, R>

Returns an iterator over randomly built values. Read more

Important traits for IterChooseFrom<'a, G, T>

Returns an iterator over values randomly chosen from a slice. Read more

Returns a (pseudo-)random, uniformly distributed u64. Read more

Fills the buffer with (pseudo-)random bytes. Read more

impl Random for Pcg
[src]

Randomly generates a value. Read more

Auto Trait Implementations

impl Send for Pcg

impl Sync for Pcg