nxt.pcg

A D port of the PCG pseudorandom number generator at http://pcg-random.org

Most of the functionality is tested against the PCG C++ implementation to ensure that the output matches. That is, the D generators should produce the same output as the C++ ones. The exception is default-initialized, unseeded generators, due to D not allowing a default constructor on structs.

64-bit generators are not supported yet, as they require the (currently unsupported) 128-bit integer types that D has not yet implemented.

Unique generators are also not supported. Seed with std.random.unpredictableSeed instead.

See: https://www.pcg-random.org/index.html Origin: https://github.com/ColonelThirtyTwo/d-pcg

Members

Aliases

PCG32
alias PCG32 = PCGEngine!(uint, ulong, xsh_rr, true, SetSeq)
Undocumented in source.
PCG32Fast
alias PCG32Fast = PCGEngine!(uint, ulong, xsh_rs, true, MCG)
PCG32OneSeq
alias PCG32OneSeq = PCGEngine!(uint, ulong, xsh_rr, true, OneSeq)

The main PCG engine.

Functions

rxs
ResultType rxs(StateType state)

Output function RXS -- random xorshift

rxs_m
ResultType rxs_m(StateType state)

Output function RXS M -- random xorshift, mcg multiply.

rxs_m_xs
ResultType rxs_m_xs(StateType state)

Output function RXS M XS -- random xorshift, mcg multiply, fixed xorshift

xsh_rr
ResultType xsh_rr(StateType state)

Output function XSH RR -- high xorshift, followed by a random rotate

xsh_rs
ResultType xsh_rs(StateType state)

Output function XSH RS -- high xorshift, followed by a random shift

xsl_rr
ResultType xsl_rr(StateType state)

Output function XSL RR -- fixed xorshift (to low bits), random rotate

Mixin templates

MCG
mixintemplate MCG(StateType)

MCG Generator.

OneSeq
mixintemplate OneSeq(StateType)

OneSeq Generator.

SetSeq
mixintemplate SetSeq(StateType)

SetSeq Generator.

Structs

PCGEngine
struct PCGEngine(ResultType, StateType, alias OutputFunc, bool OutputPrevious = true, alias StreamTypeMixin = OneSeq, StateType Multiplier = default_multiplier!StateType)

The main PCG engine.

Meta