Expand description
PCG-RXS-M-XS 64/64 random number generator nodes.
These nodes implement the PCG (Permuted Congruential Generator) family algorithm with the RXS-M-XS output permutation. The key property is O(log N) seek: any position in the sequence can be computed directly without iterating from the beginning. This makes it ideal for deterministic parallel workloads where each thread jumps to its own region of the sequence.
Three nodes are provided:
Pcg— fixed seed and stream, position is the wire inputPcgStream— fixed seed, both position and stream are wire inputsCycleWalk— bijective permutation of[0, range)via cycle-walking
CycleWalk uses multi-source #[poly_const] to derive a
CycleWalkState from (range, seed, stream) at construction
time, plus compiled_u64 = ... / jit_constants = ... overrides
that capture the cached Feistel state by Copy and publish
[range, seed, inc] to the JIT classifier.
Structs§
- Cycle
Walk - Bijective permutation of
[0, range)via cycle-walking over PCG. - Cycle
Walk State - Pre-computed Feistel state for the
cycle_walknode. Built once at construction from(range, seed, stream)via the multi-source#[poly_const]setup; consumed read-only by every cycle and by thecompiled_u64override’s captured closure. - Pcg
- PCG-RXS-M-XS 64/64 random number generator with fixed seed and stream.
- PcgStream
- PCG-RXS-M-XS 64/64 with runtime stream selection.
Constants§
- FEISTEL_
ROUNDS - Number of Feistel rounds. 6 rounds provides good diffusion.
- MULT
- LCG multiplier for the 64-bit state. 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.