Numerics. NET. Random. Engines Namespace
Remarks
The Numerics.NET.Random.Engines namespace contains the core engine layer of the Numerics.NET random number generation infrastructure. Engines are the lowest-level RNG components that own algorithm state and produce native words (UInt32 or UInt64) and bytes deterministically with a stable, portable state format.
Architecture Overview:
The RNG architecture is layered:
- Layer 1 — Engines (this namespace): Core algorithms with state ownership, native output generation, and portable persistence.
- Layer 2 — Generators: Minimal adapters that provide uniform primitive interfaces (uint/ulong generation, byte filling) with caching and block indexing.
- Layer 3 — Algorithm Classes: User-facing types with modern Random API, distribution methods, and policy support.
Core Interfaces:
- IStateful: State persistence with little-endian format
- IRandomEngine: Base engine contract with seeding, generation, and byte filling
- ICounterBased<T>: Extended contract for counter-based engines (Philox, Threefry, ChaCha)
Engine Families:
The namespace includes implementations of several modern RNG families:
- PCG family: Permuted Congruential Generators with advancement and jumping (Pcg32, Pcg64, Pcg64Dxsm)
- Xoshiro/Xoroshiro family: Fast, high-quality generators with jump support (Xoshiro256**, Xoshiro256++, Xoshiro256+, Xoroshiro128++, Xoshiro128**, Xoshiro128+)
- Counter-based family: Cryptographic-style generators with O(1) skip-ahead (Philox-4x32, Philox-4x64, Threefry-4x64, ChaCha)
- Utility generators: Specialized algorithms (SplitMix64, Sfc64, WyRand)
- Legacy algorithms: Classic generators for compatibility (MersenneTwister, MersenneTwister64, GFSR)
Portability Guarantees:
All engines guarantee:
- Identical output sequences across all platforms (x86, x64, ARM, ARM64)
- Stable state serialization format (little-endian byte order)
- Deterministic seeding from SeedSequence instances
- Little-endian byte generation regardless of host endianness
Usage Note:
Most applications should use the Layer 3 algorithm classes (e.g., Pcg64, Xoshiro256StarStar) from the Numerics.NET.Random namespace rather than working directly with engines. Engines are primarily for advanced scenarios requiring direct state manipulation or custom generator composition.
Structures
| Cha | Represents a ChaCha counter-based random number generator engine with 32-bit output. |
| Gfsr | Represents a Generalized Feedback Shift Register (GFSR) random number generator engine with 32-bit output. |
| Mersenne | Represents a MT19937-64 random number generator engine with 64-bit output. |
| Mersenne | Represents a Mersenne Twister (MT19937) random number generator engine with 32-bit output. |
| Pcg32Engine | Represents a PCG32 XSH-RR random number generator engine with 32-bit output. |
| Pcg6 | Represents a PCG64 DXSM random number generator engine with 64-bit output. |
| Pcg64Engine | Represents a PCG64 XSL-RR random number generator engine with 64-bit output. |
| Philox4x32Engine | Represents a Philox 4x32-10 counter-based random number generator engine with 32-bit output. |
| Philox4x64Engine | Represents a Philox 4x64-10 counter-based random number generator engine with 64-bit output. |
| Sfc64Engine | Represents an SFC64 random number generator engine with 64-bit output. |
| Split | Represents a SplitMix64 random number generator engine with 64-bit output. |
| Threefry4x64Engine | Represents a Threefry 4x64-20 counter-based random number generator engine with 64-bit output. |
| WyRand | Represents a WyRand random number generator engine with 64-bit output. |
| Xoroshiro128Plus | Represents a Xoroshiro128++ random number generator engine with 64-bit output. |
| Xoshiro128Plus | Represents a Xoshiro128+ random number generator engine with 32-bit output. |
| Xoshiro128Star | Represents a Xoshiro128** random number generator engine with 32-bit output. |
| Xoshiro256Plus | Represents a Xoshiro256+ random number generator engine with 64-bit output. |
| Xoshiro256Plus | Represents a Xoshiro256++ random number generator engine with 64-bit output. |
| Xoshiro256Star | Represents a Xoshiro256** random number generator engine with 64-bit output. |
Interfaces
| IBlock | Represents a block-based random number generator engine with 1:N transition topology. |
| ICounter | Represents a counter-based random number generator (CBRNG) engine. |
| IRandom | Represents the base contract for all random number generator engines. |
| IScalar | Represents a scalar random number generator engine with 1:1 transition topology. |