|
CX Framework
Cross-platform C utility framework
|
Functions | |
| void | pcgSeed (PcgState *rng, uint64 initstate, uint64 initseq) |
| void | pcgAutoSeed (PcgState *rng) |
Functions for initializing PCG generator state.
| void pcgAutoSeed | ( | PcgState * | rng | ) |
Seeds the random number generator using cryptographic-quality entropy
Uses the operating system's cryptographic random number generator (e.g., /dev/urandom, CryptGenRandom, or getrandom()) to obtain high-quality random seeds. Falls back to time-based seeding if the OS random source is unavailable.
This is the recommended seeding method for most use cases where reproducibility is not required. Note that stream selection is not meaningful when using non-deterministic seeding, so the stream is also randomly chosen.
| rng | Pointer to uninitialized PCG state |
| void pcgSeed | ( | PcgState * | rng, |
| uint64 | initstate, | ||
| uint64 | initseq | ||
| ) |
Seeds the random number generator with an initial state and sequence
This function initializes the RNG with deterministic values, allowing for reproducible random sequences. The sequence parameter selects one of 2^63 possible independent random streams.
Use this when you need reproducible results or want to select a specific stream for parallel random number generation.
| rng | Pointer to uninitialized PCG state |
| initstate | Initial state value (seed) |
| initseq | Sequence selector (stream) - determines which independent random sequence to use |