Counter Based Random Source<TGenerator, TWord> Constructor
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
Overload List
| Counter | Constructs a new counter-based random number generator using a high-entropy, automatically generated seed. |
| Counter | Constructs a new counter-based random number generator from a pre-initialized generator. |
| Counter | Constructs a new counter-based random number generator with advanced options. |
| Counter | Constructs a new counter-based random number generator from saved state. |
| Counter | Constructs a new counter-based random number generator with the specified seed. |
| Counter | Constructs a new counter-based random number generator with a seed array. |
CounterBasedRandomSource<TGenerator, TWord>
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)
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)
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>)
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)
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)
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
| Argument | seed is null. |
| Argument | seedProfile is not a valid SeedProfile value. |