SplitMix64Engine Structure

Represents a SplitMix64 random number generator engine with 64-bit output.

Definition

Namespace: Numerics.NET.Random.Engines
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
C#
public struct SplitMix64Engine : IScalarEngine<ulong>, 
	IRandomEngine, IStateful, IAdvanceable
Inheritance
Object  →  ValueType  →  SplitMix64Engine
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

C#
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

BitsPerWord Gets the native word size in bits.
Name Gets a human-readable name for this engine.
StateSize Gets the number of bytes required to save/load this engine's state.

Methods

Advance() Advances the engine state by one transition step.
Advance(UInt64) Advances the RNG state by the specified number of outputs.
EqualsIndicates 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.
GetHashCodeReturns the hash code for this instance.
(Inherited from ValueType)
GetTypeGets the Type of the current instance.
(Inherited from Object)
LoadState 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.
SaveState Saves the engine's state to the destination span in a stable little-endian format.
Seed(SeedSequence) Initializes the engine state from a seed sequence.
Seed(UInt64) Directly sets the internal 64-bit state.
ToStringReturns the fully qualified type name of this instance.
(Inherited from ValueType)

See Also