Enum RandomAlgorithm
Identifies the pseudo-random number generation algorithm to use when creating a generator via RandomUtil.
Namespace: Scylla.Core.Util.Random
Assembly: ScyllaCore.dll
Syntax
public enum RandomAlgorithm
Remarks
Each value maps to a concrete struct or class that implements IRandomSource. The table below summarises the trade-offs:
| Algorithm | State size / Period / Notes |
|---|---|
| Xoshiro256StarStar | 256-bit / 2^256 - 1 / Recommended default |
| Xoroshiro128Plus | 128-bit / 2^128 - 1 / Lightweight alternative |
| PCG32 | 128-bit / 2^64 / Multi-stream, compact save states |
| SplitMix64RNG | 64-bit / 2^64 / Minimal; primarily useful as a seeder |
| MersenneTwister | ~2.5 KB / 2^19937 - 1 / Scientific simulations |
For security-sensitive randomness (tokens, keys, nonces) use CryptoRandomSource directly rather than any value from this enum, as none of these algorithms are cryptographically secure.
Fields
| Name | Description |
|---|---|
| MersenneTwister | Mersenne Twister MT19937 (Matsumoto/Nishimura, 1998). A well-known generator with an enormous state and exceptionally long period, commonly used in scientific work. |
| PCG32 | PCG32 - Permuted Congruential Generator (O'Neill, 2014). A compact, high-quality 32-bit generator with native multi-stream support. |
| SplitMix64 | SplitMix64 (Steele et al., 2014). An extremely fast generator with a minimal 64-bit state, primarily designed as a seed expander rather than a primary source. |
| Xoroshiro128Plus | xoroshiro128+ (Vigna/Blackman). A lightweight alternative with a smaller 128-bit state that trades period for memory efficiency. |
| Xoshiro256StarStar | xoshiro256** (Vigna/Blackman, 2018). The default and recommended algorithm for most gameplay scenarios. |