Sfc 64Engine Structure
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
public struct Sfc64Engine : IScalarEngine<ulong>,
IRandomEngine, IStateful- 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
var engine = new Sfc64Engine();
engine.Seed(SeedSequences.SplitMix64(123));
ulong value = engine.Next();
ulong[] values = new ulong[100];
engine.Fill(values);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. |
| 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 SFC64 state words and counter. |
| ToString | Returns the fully qualified type name of this instance. (Inherited from ValueType) |