MersenneTwisterEngine.LoadState Method

Loads the engine's state from the source span in a stable little-endian format.

Definition

Namespace: Numerics.NET.Random.Engines
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
C#
public void LoadState(
	ReadOnlySpan<byte> source
)

Parameters

source  ReadOnlySpan<Byte>
The source span containing state bytes to load. Must have a length of at least StateSize.

Implements

IStateful.LoadState(ReadOnlySpan<Byte>)

Remarks

The source span may be larger than StateSize; only the first StateSize bytes are read. Additional bytes are ignored.

After loading state, the engine will produce the same sequence of outputs it would have produced immediately after saving the state.

The state format uses little-endian byte order for all multi-byte values, ensuring cross-platform portability.

Exceptions

ArgumentException Thrown when source.Length < StateSize.

See Also