Random

PCG algorithms, constants, and wrappers

Based on this paper PCG: A Family of Simple Fast Space-Efficient Statistically Good Algorithms for Random Number Generation and this C++ header: pcg_variants.h

Abbreviations:

Generator uint value

A psuedorandom value generator

Generation uint value

A psuedorandom value, paired with its Generator's output state (for chaining)

State uint

Internal state for Generators

seed : U32 -> State U32

Construct a "seed"

A "seed" is an initial State for Generators.

This is an alias for seed32.

seedVariant : U32, U32 -> State U32

Construct a specific "variant" of a "seed"

A "seed" is an initial State for Generators.

A "variant" is a State that specifies a c.updateIncrement constant, to produce a sequence of internal values that shares no consecutive pairs with other variants of the same State.

Odd numbers are recommended for the update increment, to double the repetition period of sequences (by hitting odd values).

This is an alias for seed32Variant.

seed8 : U8 -> State U8

Construct an initial State from 8 bits of noise

seed8Variant : U8, U8 -> State U8

Construct an initial State from 8 bits of noise and a specific increment for updating

seed16 : U16 -> State U16

Construct an initial State from 16 bits of noise

seed16Variant : U16, U16 -> State U16

Construct an initial State from 16 bits of noise and a specific increment for updating

seed32 : U32 -> State U32

Construct an initial State from 32 bits of noise

seed32Variant : U32, U32 -> State U32

Construct an initial State from 32 bits of noise and a specific increment for updating

next : Generation uint *, Generator uint value -> Generation uint value

Generate a new Generation from an old Generation's state

step : State uint, Generator uint value -> Generation uint value

Generate a Generation from a state

int : I32, I32 -> Generator U32 I32

Construct a Generator for 32-bit unsigned integers between two boundaries (inclusive)

This is an alias for i32.

i8 : I8, I8 -> Generator U8 I8

Construct a Generator for 8-bit signed integers between two boundaries (inclusive)

i16 : I16, I16 -> Generator U16 I16

Construct a Generator for 16-bit signed integers between two boundaries (inclusive)

i32 : I32, I32 -> Generator U32 I32

Construct a Generator for 32-bit signed integers between two boundaries (inclusive)

u8 : U8, U8 -> Generator U8 U8

Construct a Generator for 8-bit unsigned integers between two boundaries (inclusive)

u16 : U16, U16 -> Generator U16 U16

Construct a Generator for 16-bit unsigned integers between two boundaries (inclusive)

u32 : U32, U32 -> Generator U32 U32

Construct a Generator for 32-bit unsigned integers between two boundaries (inclusive)