Struct PCG32State
Represents the complete serializable internal state of a PCG32 (Permuted Congruential Generator) random number generator. Capturing this struct and passing it back to SetState(PCG32State) fully restores the generator to the exact point it was when the snapshot was taken, enabling deterministic save/load and replay.
Inherited Members
Namespace: Scylla.Core.Util.Random
Assembly: ScyllaCore.dll
Syntax
[Serializable]
public struct PCG32State
Remarks
PCG32 uses a linear congruential generator (LCG) internally. The State
value advances by the formula state = state * PCG_MULTIPLIER + inc on each
step, and the output is produced by applying the XSH-RR (XOR-Shift High, Random
Rotate) output function to the pre-advance state.
The Inc field selects one of 2^63 independent, non-overlapping streams. SetState(PCG32State) automatically forces the increment to be odd (a requirement for the LCG to have full period 2^64).
Fields
Inc
The 64-bit stream selector (increment) of the PCG32 generator. Must be an odd number to guarantee the LCG has a full period of 2^64. Different increment values produce statistically independent, non-overlapping output sequences even when starting from the same State.
Declaration
public ulong Inc
Field Value
| Type | Description |
|---|---|
| ulong |
State
The 64-bit LCG state value of the PCG32 generator. This value advances deterministically on every call to NextUInt32().
Declaration
public ulong State
Field Value
| Type | Description |
|---|---|
| ulong |