MersenneTwisterEngine.Seed Method

Definition

Namespace: Numerics.NET.Random.Engines
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0

Overload List

Seed(ReadOnlySpan<UInt32>) Initializes the generator with an array of keys (init_by_array).
Seed(SeedSequence) Initializes the engine state from a seed sequence.
Seed(UInt32) Initializes the generator with a single seed (init_genrand).

Seed(ReadOnlySpan<UInt32>)

Initializes the generator with an array of keys (init_by_array).
C#
public void Seed(
	ReadOnlySpan<uint> initKey
)

Parameters

initKey  ReadOnlySpan<UInt32>
The initialization key array.

Remarks

This is the canonical MT19937 init-by-array initialization routine. Mixes the key array into the state using the reference algorithm's two-phase mixing loops.

Exceptions

ArgumentExceptionThrown when initKey is empty.

Seed(SeedSequence)

Initializes the engine state from a seed sequence.
C#
public void Seed(
	SeedSequence seed
)

Parameters

seed  SeedSequence
The seed sequence providing entropy.

Implements

IRandomEngine.Seed(SeedSequence)

Exceptions

ArgumentNullExceptionThrown when seed is null.

Seed(UInt32)

Initializes the generator with a single seed (init_genrand).
C#
public void Seed(
	uint seed
)

Parameters

seed  UInt32
The seed value.

Remarks

This is the canonical MT19937 single-seed initialization routine (init_genrand). Uses the standard Knuth multiplier 1812433253 to fill the state array.

See Also