Overview of RNG algorithms

If in doubt which algorithm to choose, choose the GRandom class.

PRNGPeriodStatistic Errors (practrand)
xorshift32 (default Unity)2^(32)-126
xoroshiro128+2^(128)-14
Lcg642^(64)-1-
Lehmer3x642^(64)-1-
Lehmer322^(32)-1-
Lehmer642^(64)-1-
Pcg322^(64)-1-
Pcg642^(64)-1-
Pcg64f2^(64)-1-
SplitMix642^(64)-1-
Xoroshiro4x128P+/Unsafe2^(128)-1-
Xoroshiro128+2^(128)-1-
Xoroshiro128++2^(128)-1-
Xoroshiro128** (GRandom)2^(128)-1-
Xoshiro256+2^(512)-1-
Xoshiro256++2^(256)-1-
Xoshiro256**2^(256)-1-
Xoshiro512+2^(512)-1-
Xoshiro512++2^(512)-1-
Xoshiro512*2^(512)-1-
Xoroshiro1024*2^(1024)-1(lower bits only: 2)
Xoroshiro1024**Unsafe2^(1024)-1(lower bits only: 2)

Xorshift/Xoshiro/Xoroshiro Variants

These generators are very popular and are used in Java, JavaScript, Rust, .NET, Erlang, Julia and others. These are a subset of linear-feedback shift registers (LFSRs) and often use a XOR operation to generate the next element in the sequence. These generators are very fast while also providing good statistical values.

Homepage

Pcg (32/64)

The permuted congruential generator (PCG) tries to have good statistical quality by also using minimal internal state. It uses an output permutation function to improve the statistical properties of a linear congruential generator (LCG).

Homepage

SplitMix

SplitMix is a splittable pseudorandom number generator which is very fast, but doesn’t provide good statistical properties. It is often used to seed other generators.

Paper

Lehmer and Linear Congruential Generator (LCG)

Linear congruential generators use a simple multiplication and a modulo operation (which is done automatically with a number overflow) to generate the next random number. Lehmer variants use specific multiplicators otherwise these generators are identical.

Homepage