ICounter Based<T>.Set Key Method
Sets the key to the specified value.
Definition
Namespace: Numerics.NET.Random.Engines
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
C#
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
void SetKey(
ReadOnlySpan<T> key
)Parameters
- key ReadOnlySpan<T>
- The new key value. Length must exactly match KeyLength.
Remarks
Setting the key changes the parameterization of the generator. The same counter value with different keys produces different output blocks.
Consistency Protocol:
After calling SetKey(ReadOnlySpan<T>), the engine enters an inconsistent state where the cached block does not correspond to the current key/counter coordinates. Callers must invoke GenerateBlock() before using any output mapping methods (Output(Int32) or Fill(Int32, Span<T>)). Invoking output methods while inconsistent results in undefined behavior.
Exceptions
| Argument | Thrown when key.Length != KeyLength. |