CounterBasedRandomSource<TGenerator, TWord> Constructor

Definition

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

Overload List

CounterBasedRandomSource<TGenerator, TWord>() Constructs a new counter-based random number generator using a high-entropy, automatically generated seed.
CounterBasedRandomSource<TGenerator, TWord>(TGenerator) Constructs a new counter-based random number generator from a pre-initialized generator.
CounterBasedRandomSource<TGenerator, TWord>(RandomOptions) Constructs a new counter-based random number generator with advanced options.
CounterBasedRandomSource<TGenerator, TWord>(ReadOnlySpan<Byte>) Constructs a new counter-based random number generator from saved state.
CounterBasedRandomSource<TGenerator, TWord>(Int64, StreamAddress, SeedProfile) Constructs a new counter-based random number generator with the specified seed.
CounterBasedRandomSource<TGenerator, TWord>(ReadOnlySpan<TWord>, StreamAddress, SeedProfile) Constructs a new counter-based random number generator with a seed array.

CounterBasedRandomSource<TGenerator, TWord>

Constructs a new counter-based random number generator using a high-entropy, automatically generated seed.
C#
protected CounterBasedRandomSource()

Remarks

This constructor uses the Independent seed profile. It provides a convenient way to create a unique, statistically sound random source without requiring manual seed management.

For large-scale parallel simulations requiring a high degree of coordination between many streams, consider using the explicit streaming methods provided by RandomStreamTree<TRandom> or RandomStreamPartition<TRandom>.

CounterBasedRandomSource<TGenerator, TWord>(TGenerator)

Constructs a new counter-based random number generator from a pre-initialized generator.
C#
protected CounterBasedRandomSource(
	 in TGenerator generator
)

Parameters

generator  TGenerator
The pre-initialized generator to use.

Remarks

This constructor bypasses normal initialization and directly uses the provided generator. Use this for constructors that call engine Seed methods directly.

CounterBasedRandomSource<TGenerator, TWord>(RandomOptions)

Constructs a new counter-based random number generator with advanced options.
C#
protected CounterBasedRandomSource(
	 in RandomOptions options
)

Parameters

options  RandomOptions
The initialization options containing seed, stream ID, and seed profile.

Remarks

This constructor validates the options and calls Initialize(RandomOptions, TGenerator) to configure the generator.

CounterBasedRandomSource<TGenerator, TWord>(ReadOnlySpan<Byte>)

Constructs a new counter-based random number generator from saved state.
C#
protected CounterBasedRandomSource(
	ReadOnlySpan<byte> state
)

Parameters

state  ReadOnlySpan<Byte>
The saved state to restore.

Remarks

This constructor bypasses normal initialization and directly loads the state. Use this for exact continuation from a previously saved state.

CounterBasedRandomSource<TGenerator, TWord>(Int64, StreamAddress, SeedProfile)

Constructs a new counter-based random number generator with the specified seed.
C#
protected CounterBasedRandomSource(
	long seed,
	StreamAddress streamAddress,
	SeedProfile seedProfile
)

Parameters

seed  Int64
The initial seed of the generator.
streamAddress  StreamAddress
Optional stream identifier for stream selection (default: empty).
seedProfile  SeedProfile
The seed profile (default: Default).

CounterBasedRandomSource<TGenerator, TWord>(ReadOnlySpan<TWord>, StreamAddress, SeedProfile)

Constructs a new counter-based random number generator with a seed array.
C#
protected CounterBasedRandomSource(
	ReadOnlySpan<TWord> seed,
	StreamAddress streamAddress,
	SeedProfile seedProfile
)

Parameters

seed  ReadOnlySpan<TWord>
The seed array values.
streamAddress  StreamAddress
Optional stream identifier for stream selection (default: empty).
seedProfile  SeedProfile
The seed profile (default: Default).

Remarks

This constructor validates inputs and calls Initialize(RandomOptions, TGenerator) to configure the generator according to the specified seed profile.

Exceptions

ArgumentNullExceptionseed is null.
ArgumentOutOfRangeExceptionseedProfile is not a valid SeedProfile value.

See Also