Class: PCG64

numpy-compat.PCG64(seedopt)

PCG64 (PCG-XSL-RR 128/64), numpy's default bit generator. Seeded through SeedSequence exactly as numpy, so new PCG64(seed).random() equals np.random.default_rng(seed).random(). Uses BigInt 128-bit arithmetic, so it is slower than the 32-bit generators; prefer it when cross-language reproducibility matters.

Constructor

new PCG64(seedopt)

Parameters:
Name Type Attributes Description
seed number | bigint | Array.<number> | SeedSequence <optional>

Seed or SeedSequence. Random if omitted.

Source:

Methods

advance(delta) → {this}

Advances the state by delta steps in O(log delta) (numpy advance).

Parameters:
Name Type Description
delta number | bigint
Source:
Returns:
Type
this

next()

Steps and stores the next 64-bit output in (outHi, outLo). @private

Source:

nextUint32() → {number}

Unsigned 32-bit output; uses both halves of each 64-bit output (low half first), as numpy.

Source:
Returns:
Type
number

nextUint64() → {bigint}

Next unsigned 64-bit output as a bigint.

Source:
Returns:
Type
bigint

nextUint64Parts() → {Array.<number>}

Next 64-bit output as [hi, lo] unsigned 32-bit numbers (XSL-RR output function).

Source:
Returns:
Type
Array.<number>

random() → {number}

Uniform double in [0, 1) from the top 53 bits of one 64-bit output (numpy random).

Source:
Returns:
Type
number

step()

state = state * multiplier + inc (mod 2^128), with 32-bit limbs. @private

Source: