Skip to main content

Module pcg

Module pcg 

Source
Expand description

The PCG-RXS-M-XS generator, its O(log N) seek, and the Feistel cycle walk: the bodies of pcg, pcg_stream, and cycle_walk, which the native lowerings and the comprehension strategies call.

Structs§

CycleWalkState
Pre-computed Feistel state for the cycle_walk node. Built once at construction from (range, seed, stream) via the multi-source #[poly_const] setup; consumed read-only by every cycle and by the compiled_u64 override’s captured closure.

Constants§

FEISTEL_ROUNDS
Number of Feistel rounds. 6 rounds provides good diffusion.
MULT
The LCG multiplier of the 64-bit state.

Functions§

build_cycle_walk_state
Joint Feistel-state derivation. Single-call construction-time invocation per node instance; the macro emits the call inside the generated CycleWalk::new(range, seed, stream).
cycle_walk_inner
Apply cycle-walking with the Feistel bijection.
pcg_output
Apply the RXS-M-XS output permutation to an LCG state.
pcg_seek
Seek to an arbitrary position in the PCG sequence in O(log N) time.