Philox 4x 64Engine.Generate Block Method
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.3.0
Overload List
| Generate | Computes the output block for the current key and counter. |
| Generate | Generates a block of random output by applying the Philox bijection. |
GenerateBlock
Remarks
This method applies the algorithm-specific permutation function (e.g., Philox rounds, Threefry rounds, ChaCha quarter-rounds) to compute the output block for the current key/counter combination. The generated block is stored in engine-owned storage and can be accessed via the engine's Output(Int32) method.
This method does not advance the counter. It materializes the cached block for the current coordinates, bringing the engine from an inconsistent state to a consistent state.
After calling GenerateBlock(), the engine is in a consistent state and output methods may be safely invoked.
GenerateBlock(ReadOnlySpan<UInt64>, ReadOnlySpan<UInt64>, Span<UInt64>)
public static void GenerateBlock(
ReadOnlySpan<ulong> key,
ReadOnlySpan<ulong> counter,
Span<ulong> output
)Parameters
- key ReadOnlySpan<UInt64>
- The 2-word (128-bit) key. Must have exactly 2 elements.
- counter ReadOnlySpan<UInt64>
- The 4-word (256-bit) counter input. Must have exactly 4 elements.
- output Span<UInt64>
- The 4-word (256-bit) output buffer. Must have exactly 4 elements.
Remarks
This method applies the Philox-4x64-10 bijection to transform a counter into a pseudo-random output block using the provided key. The transformation is deterministic: the same key and counter will always produce the same output.
Exceptions
| Argument | Thrown when any span does not have the correct length. |