|
CX Framework
Cross-platform C utility framework
|
Functions | |
| void | pcgAdvance (PcgState *rng, uint64 delta) |
Advanced functions for manipulating generator state.
| void pcgAdvance | ( | PcgState * | rng, |
| uint64 | delta | ||
| ) |
Advances the RNG state forward (or backward) by a specified number of steps
Efficiently jumps the RNG state forward or backward without generating intermediate values. This is useful for:
The algorithm uses O(log(delta)) time complexity based on fast exponentiation, making even very large jumps efficient.
Note: Passing a negative value (as uint64) will advance backward, effectively "jumping back" in the sequence.
Example:
| rng | Pointer to initialized PCG state |
| delta | Number of steps to advance (can be negative to go backward) |