ChaChaEngine.AdvanceBlock Method

Definition

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

Overload List

AdvanceBlock() Advances the engine state to the next block (next entropy window).
AdvanceBlock(UInt64) Advances the counter by the specified number of blocks.

AdvanceBlock

Advances the engine state to the next block (next entropy window).
C#
public void AdvanceBlock()

Implements

IBlockEngine<T>.AdvanceBlock()

Remarks

This method performs the block transition function, moving the engine to a new block of output values. After this call, Output(Int32) will return values from the new block.

The block transition is algorithm-specific and deterministic. Successive calls to AdvanceBlock() move through the generator's sequence in a reproducible manner.

AdvanceBlock(UInt64)

Advances the counter by the specified number of blocks.
C#
public void AdvanceBlock(
	ulong blockCount
)

Parameters

blockCount  UInt64
The number of blocks to advance. Each block corresponds to BlockLength output values.

Implements

ICounterBased<T>.AdvanceBlock(UInt64)

Remarks

This method increments the counter by blockCount in counter space, performing proper carry propagation for multi-word counters. This provides O(1) skip-ahead capability.

This operation is an overload of the single-step AdvanceBlock() method, allowing efficient advancement by multiple blocks.

Consistency:

After calling AdvanceBlock(UInt64), implementations may either regenerate the block (leaving the engine consistent) or leave the block stale (leaving the engine inconsistent). Callers should assume the engine is inconsistent after this call and invoke GenerateBlock() before using output methods.

See Also