SeedSequences.Direct Method

Definition

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

Overload List

Direct(ReadOnlySpan<UInt32>) Creates a SeedSequence that emits provided 32-bit values verbatim.
Direct(ReadOnlySpan<UInt64>) Creates a SeedSequence that emits provided values verbatim.
Direct(UInt64) Creates a SeedSequence that emits a single provided value verbatim.

Direct(ReadOnlySpan<UInt32>)

Creates a SeedSequence that emits provided 32-bit values verbatim.
C#
public static SeedSequence Direct(
	ReadOnlySpan<uint> values
)

Parameters

values  ReadOnlySpan<UInt32>
The 32-bit values to emit.

Return Value

SeedSequence
A SeedSequence that emits the provided values.

Remarks

This method creates a seed algorithm that emits the provided 32-bit values in order, then emits zeros after exhaustion.

No sanitization or correction is performed. If the resulting PRNG state is invalid, the PRNG constructor must throw an exception.

This is useful for exact state transfer from other languages, debuggers, or serialized checkpoints.

Direct(ReadOnlySpan<UInt64>)

Creates a SeedSequence that emits provided values verbatim.
C#
public static SeedSequence Direct(
	ReadOnlySpan<ulong> values
)

Parameters

values  ReadOnlySpan<UInt64>
The values to emit.

Return Value

SeedSequence
A SeedSequence that emits the provided values.

Remarks

This method creates a seed algorithm that emits the provided values in order, then emits zeros after exhaustion.

No sanitization or correction is performed. If the resulting PRNG state is invalid, the PRNG constructor must throw an exception.

This is useful for exact state transfer from other languages, debuggers, or serialized checkpoints.

Example

C#
// Create a seed algorithm with explicit state values
var seedSequence = SeedAlgorithms.Direct(0x123456789ABCDEF0UL, 0xFEDCBA9876543210UL);
var rng = new Xoshiro256StarStar(seedSequence);

Direct(UInt64)

Creates a SeedSequence that emits a single provided value verbatim.
C#
public static SeedSequence Direct(
	ulong value
)

Parameters

value  UInt64
The value to emit.

Return Value

SeedSequence
A SeedSequence that emits the provided value.

Remarks

This method creates a seed algorithm that emits the provided value, then emits zeros after exhaustion.

No sanitization or correction is performed. If the resulting PRNG state is invalid, the PRNG constructor must throw an exception.

See Also