If in doubt which algorithm to choose, choose the GRandom
class.
PRNG | Period |
---|---|
xorshift32 (default Unity) | 2^32 - 1 |
xoroshiro128+ | 2^128 - 1 |
Lcg64 | 2^64 - 1 |
Lehmer3x64 | 2^64 - 1 |
Lehmer32 | 2^32 - 1 |
Lehmer64 | 2^64 - 1 |
Pcg32 | 2^64 - 1 |
Pcg64 | 2^64 - 1 |
Pcg64f | 2^64 - 1 |
SplitMix64 | 2^64 - 1 |
Xoroshiro4x128P+/Unsafe | 2^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 |
Xoroshiro1024**Unsafe | 2^1024 - 1 |
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.
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).
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.
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.