Cha Cha Constructor
Definition
Namespace: Numerics.NET.Random
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
Overload List
| Cha | Initializes a new instance of the ChaCha class using OS entropy. |
| Cha | Initializes a new instance of the ChaCha class with the specified options. |
| Cha | Initializes a new instance of the ChaCha class from saved state. |
| Cha | Constructs a new ChaCha random number generator with the specified seed and variant. |
| Cha | Initializes a new instance of the ChaCha class with the specified seed. |
| Cha | Initializes a new instance of the ChaCha class with the specified seed array. |
| Cha | Constructs a new ChaCha random number generator with the specified seed and variant. |
| Cha | Constructs a new ChaCha random number generator with the specified seed, stream ID, and variant. |
| Cha | Initializes a new instance of the ChaCha class with the specified seed. |
| Cha | Initializes a new instance of the ChaCha class with the specified seed array. |
ChaCha
Initializes a new instance of the ChaCha class using OS entropy.
public ChaCha()ChaCha(RandomOptions)
Initializes a new instance of the ChaCha class with the specified options.
public ChaCha(
RandomOptions options
)Parameters
- options RandomOptions
- The initialization options containing seed, stream ID, and seed profile.
ChaCha(ReadOnlySpan<Byte>)
Initializes a new instance of the ChaCha class from saved state.
public ChaCha(
ReadOnlySpan<byte> state
)Parameters
- state ReadOnlySpan<Byte>
- The saved state to restore.
Exceptions
| Argument | The length of state is less than the required state size. |
ChaCha(Int64, ChaChaVariant)
Constructs a new ChaCha random number generator with the specified seed and variant.
public ChaCha(
long seed,
ChaChaVariant variant
)Parameters
- seed Int64
- The initial seed of the generator.
- variant ChaChaVariant
- The ChaCha variant.
Remarks
This constructor uses the SplitMix64 seeding algorithm and Generic stream mode.
Variant mapping:
Example
var rng = new ChaCha20(54321, ChaChaVariant.ChaCha8);Exceptions
| Argument | Thrown when variant is not a valid ChaChaVariant value. |
ChaCha(Int64, SeedProfile)
Initializes a new instance of the ChaCha class with the specified seed.
public ChaCha(
long seed,
SeedProfile seedProfile = SeedProfile.Default
)Parameters
- seed Int64
- A number used to calculate a starting value for the pseudo-random number sequence.
- seedProfile SeedProfile (Optional)
- The seed profile to use for initialization.
ChaCha(ReadOnlySpan<UInt32>, SeedProfile)
Initializes a new instance of the ChaCha class with the specified seed array.
public ChaCha(
ReadOnlySpan<uint> seedMaterial,
SeedProfile seedProfile = SeedProfile.Default
)Parameters
- seedMaterial ReadOnlySpan<UInt32>
- An array of numbers used to calculate a starting value for the pseudo-random number sequence.
- seedProfile SeedProfile (Optional)
- The seed profile to use for initialization.
Exceptions
| Argument | seedMaterial is null. |
ChaCha(ReadOnlySpan<UInt64>, ChaChaVariant)
Constructs a new ChaCha random number generator with the specified seed and variant.
public ChaCha(
ReadOnlySpan<ulong> seedArray,
ChaChaVariant variant
)Parameters
- seedArray ReadOnlySpan<UInt64>
- The seed array values.
- variant ChaChaVariant
- The ChaCha variant.
Remarks
This constructor uses the SplitMix64 seeding algorithm and Generic stream mode.
Variant mapping:
Exceptions
| Argument | Thrown when variant is not a valid ChaChaVariant value. |
ChaCha(Int64, StreamAddress, ChaChaVariant)
Constructs a new ChaCha random number generator with the specified seed, stream ID, and variant.
public ChaCha(
long seed,
StreamAddress streamAddress,
ChaChaVariant variant
)Parameters
- seed Int64
- The initial seed of the generator.
- streamAddress StreamAddress
- Optional stream identifier for stream selection.
- variant ChaChaVariant
- The ChaCha variant.
Remarks
This constructor uses the SplitMix64 seeding algorithm.
Variant mapping:
Exceptions
| Argument | Thrown when variant is not a valid ChaChaVariant value. |
ChaCha(Int64, StreamAddress, SeedProfile)
Initializes a new instance of the ChaCha class with the specified seed.
public ChaCha(
long seed,
StreamAddress streamAddress,
SeedProfile seedProfile = SeedProfile.Default
)Parameters
- seed Int64
- A number used to calculate a starting value for the pseudo-random number sequence.
- streamAddress StreamAddress
- Optional stream identifier for stream selection.
- seedProfile SeedProfile (Optional)
- The seed profile to use for initialization.
ChaCha(ReadOnlySpan<UInt32>, StreamAddress, SeedProfile)
Initializes a new instance of the ChaCha class with the specified seed array.
public ChaCha(
ReadOnlySpan<uint> seedMaterial,
StreamAddress streamAddress,
SeedProfile seedProfile = SeedProfile.Default
)Parameters
- seedMaterial ReadOnlySpan<UInt32>
- An array of numbers used to calculate a starting value for the pseudo-random number sequence.
- streamAddress StreamAddress
- Optional stream address for stream selection.
- seedProfile SeedProfile (Optional)
- The seed profile to use for initialization.
Exceptions
| Argument | seedMaterial is null. |