Skip to content

pcg32

pcg32(seed): RandomFn

Defined in: pcg32.ts:18

Creates a seeded pseudo-random number generator function using the PCG32 algorithm (Permuted Congruential Generator, 32-bit output) by Melissa O’Neill (2014).

Uses a 64-bit LCG state with a scrambled output function. Excellent statistical quality.

The seed is accepted as a JS number; values above 2^53 may lose precision due to IEEE 754 double representation before the BigInt conversion.

number

The seed value to initialize the 64-bit internal state.

RandomFn

A function that generates pseudo-random numbers in the range [0, 1) when called.