Xoshiro 128Star Star Engine Structure
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
public struct Xoshiro128StarStarEngine : IScalarEngine<uint>,
IRandomEngine, IStateful, IAdvanceable, IJumpable- Implements
- IRandomEngine, IScalarEngine<UInt32>, IAdvanceable, IJumpable, IStateful
Remarks
The Xoshiro128** (Xor-Shift-Rotate 128 Star-Star) engine is a 32-bit all-purpose random number generator by David Blackman and Sebastiano Vigna. It features a 128-bit state with a period of 2128 - 1 and passes all statistical tests.
Algorithm Details:
- State size: 128 bits (4 × 32-bit words)
- Output function: ** (Star-Star) scrambler: rotl(s[1] * 5, 7) * 9
- Period: 2128 - 1
- Performance: One of the fastest high-quality 32-bit RNGs
Compatibility:
This is a modern, fast, high-quality 32-bit generator suitable for general-purpose use, with excellent performance on modern CPUs.
Use Cases:
The "**" scrambler makes it suitable for general-purpose use including integer generation, simulations, games, and Monte Carlo methods. For floating-point generation, consider using Xoshiro128+.
Reference: David Blackman and Sebastiano Vigna. "Scrambled Linear Pseudorandom Number Generators." ACM Trans. Math. Softw. 2021.
See also: https://prng.di.unimi.it/
Example
var engine = new Xoshiro128StarStarEngine();
engine.Seed(SeedSequences.SplitMix64(123));
uint value = engine.Next();
uint[] values = new uint[100];
engine.Fill(values);
// Jump for parallel streams
engine.Jump();Properties
| Bits | Gets the native word size in bits. |
| Jump | Gets the size category of the primary jump operation. |
| Long | Gets the size category of the long jump operation. |
| 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) |
| Jump | Jumps the RNG forward by the specified number of primary jump strides. |
| Load | Loads the engine's state from the source span in a stable little-endian format. |
| Long | Jumps the RNG forward by the specified number of long jump strides. |
| 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 four 32-bit state words. |
| ToString | Returns the fully qualified type name of this instance. (Inherited from ValueType) |