Split Mix 64Engine Structure
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
public struct SplitMix64Engine : IScalarEngine<ulong>,
IRandomEngine, IStateful, IAdvanceable- Implements
- IRandomEngine, IScalarEngine<UInt64>, IAdvanceable, IStateful
Remarks
The SplitMix64 engine is a fast 64-bit hash-based pseudo-random number generator by Guy Steele and Doug Lea. It is primarily designed for seeding other generators and is compatible with Java's SplittableRandom.
Algorithm Details:
- State size: 64 bits (1 × 64-bit word)
- Output function: Hash-based mixing with three multiply-mix operations
- Period: 264
- Performance: Very fast with good statistical quality
Compatibility:
This generator is widely used for seeding Xoshiro/Xoroshiro generators (as recommended by Vigna) and is compatible with Java's SplittableRandom.
Use Cases:
Primary use is entropy expansion and seeding other generators. The simple state structure and excellent mixing properties make it ideal for initializing generators that require high-quality, well-distributed initial states.
Advancement:
SplitMix64 supports efficient O(1) advancement via IAdvanceable. The state transition is a simple addition, allowing instant forward jumps.
Reference: Guy L. Steele Jr., Doug Lea, and Christine H. Flood. "Fast splittable pseudorandom number generators." OOPSLA 2014.
Example
var engine = new SplitMix64Engine();
engine.Seed(SeedSequences.Direct(123));
ulong value = engine.Next();
ulong[] values = new ulong[100];
engine.Fill(values);
// Advance by 1000 steps in O(1) time
engine.Advance(1000);Properties
| Bits | Gets the native word size in bits. |
| Name | Gets a human-readable name for this engine. |
| State | Gets the number of bytes required to save/load this engine's state. |
Methods
| Advance() | Advances the engine state by one transition step. |
| Advance( | Advances the RNG state by the specified number of outputs. |
| Equals | Indicates whether this instance and a specified object are equal. (Inherited from ValueType) |
| Fill | Fills the destination span with successive native words from the engine's stream. |
| Get | Returns the hash code for this instance. (Inherited from ValueType) |
| Get | Gets the Type of the current instance. (Inherited from Object) |
| Load | Loads the engine's state from the source span in a stable little-endian format. |
| Next | Advances the engine by one step and returns the native word produced for that step. |
| Output | Returns the native word produced by applying the output mapping function to the current engine state, without mutating that state. |
| Save | Saves the engine's state to the destination span in a stable little-endian format. |
| Seed( | Initializes the engine state from a seed sequence. |
| Seed( | Directly sets the internal 64-bit state. |
| ToString | Returns the fully qualified type name of this instance. (Inherited from ValueType) |