Sfc64Engine Structure

Represents an SFC64 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 Sfc64Engine : IScalarEngine<ulong>, 
	IRandomEngine, IStateful
Inheritance
Object  →  ValueType  →  Sfc64Engine
Implements
IRandomEngine, IScalarEngine<UInt64>, IStateful

Remarks

The SFC64 (Small Fast Chaotic 64-bit) engine is a chaotic pseudo-random number generator by Chris Doty-Humphrey. It uses simple operations (addition, rotation, and XOR) to achieve excellent speed and statistical properties.

Algorithm Details:

  • State size: 256 bits (3 × 64-bit words + 1 counter)
  • Output function: Chaotic mixing with three-rotate operations
  • Period: Minimum 264, average approximately 2255
  • Performance: Very fast with excellent statistical quality

Statistical Quality:

SFC64 passes all statistical tests including BigCrush and PractRand with no failures. It uses only simple operations making it highly efficient on modern processors.

Use Cases:

Ideal for high-performance computing, simulations, games, and Monte Carlo methods where speed and quality are both critical. The chaotic mixing provides strong decorrelation between outputs.

Advancement:

SFC64 does not support mathematical advancement or jumping due to its chaotic nature. Only implements IStateful for state persistence.

Reference: Chris Doty-Humphrey. "PractRand: Practical PRNG Testing." http://pracrand.sourceforge.net/

Example

C#
var engine = new Sfc64Engine();
engine.Seed(SeedSequences.SplitMix64(123));

ulong value = engine.Next();

ulong[] values = new ulong[100];
engine.Fill(values);

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.
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, UInt64, UInt64, UInt64) Directly sets the SFC64 state words and counter.
ToStringReturns the fully qualified type name of this instance.
(Inherited from ValueType)

See Also