Non-cryptographic PRNGs

PCG64-Dxsm

Permuted congruential generators: LCG state with a permutation on output

unverified Root API only Not cryptographic
Unverified tier.

Source found and wired, correctness not fully proven. Root API only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.

About PCG64-Dxsm

PCG64-Dxsm is one of 4 PCG variants in the NextSSL registry, a non-cryptographic pseudorandom generator. It uses a 1–268,435,456-byte output and a 32-byte seed. Its registry entry cites PCG64 DXSM (O'Neill 2019), NOT cryptographically secure. NextSSL lists it in the unverified tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).

Overview

PCG is a family of pseudorandom number generators that combine a linear congruential generator's state transition with an output permutation that hides its statistical weaknesses. They are fast, compact and statistically strong, and PCG64 is the default bit generator in NumPy, but they are not cryptographic.

A plain linear congruential generator (LCG) computes state = a*state + c modulo a power of two; its low bits have short periods and its output is easy to predict. PCG keeps the LCG state transition but outputs a permuted function of the state, such as a random rotation or an xorshift followed by a multiply, selected by the state's high bits. This produces output that passes demanding statistical test suites while keeping a tiny state.

Four variants are present. PCG32 uses a 64-bit state and produces 32-bit outputs. PCG64 uses a 128-bit LCG with the XSL-RR output function. PCG64-DXSM uses a stronger double-xorshift-multiply output function introduced later to address correlations between streams. PCG64-MCG uses a multiplicative congruential generator (c = 0), which is slightly faster but has a shorter period. Except for the MCG form, the variants support multiple independent streams selected by the increment.

History

2014–2014
  1. PCG published by Melissa E. O'Neill

How it works

  1. Advance the state: state = a*state + c mod 2^k (c = 0 for MCG).
  2. Apply the output permutation to the old or new state to produce the result.
  3. Select independent streams by choosing different odd increments c.
  4. Jump ahead in logarithmic time using LCG arithmetic.

Security notes

Not cryptographically secure: the internal state can be recovered from outputs with modest computation, making future outputs predictable. Do not use it for keys, nonces, session IDs or tokens; use the OS RNG or a DRBG.

Typical uses

Scientific computing (NumPy default_rng)Simulations needing independent streamsGames and procedural content

Sizes

FieldBytesMeaning
out1 – 268,435,456Output
seed32Seed

Use it

from nextssl_demo import NextSSL

root = NextSSL(root=True)   # tier 'unverified' is reachable from the root API only
buf = root.call("rng_fill", "pcg64-dxsm", "seed=42", 32)[0]   # not for keys

Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.

Other PCG variants

3

Frequently asked questions

What is PCG64-Dxsm?

PCG64-Dxsm is a PRNG in the PCG family. PCG is a family of pseudorandom number generators that combine a linear congruential generator's state transition with an output permutation that hides its statistical weaknesses.

What are the PCG64-Dxsm sizes?

In NextSSL, PCG64-Dxsm uses: output 1 to 268,435,456 bytes.

Who designed PCG64-Dxsm and when?

PCG64-Dxsm belongs to the PCG family, first published in 2014 by Melissa E. O'Neill. Its origin: O'Neill, PCG: A Family of Simple Fast Space-Efficient Statistically Good Algorithms for Random Number Generation.

Which standards define PCG64-Dxsm?

PCG64-Dxsm is referenced by PCG64 DXSM (O'Neill 2019), NOT cryptographically secure.

Is PCG64-Dxsm safe to use?

PCG64-Dxsm is in the unverified tier. Source found and wired, correctness not fully proven. Root API only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).

What other PCG variants are there?

NextSSL also registers pcg32, pcg64, pcg64-mcg in the PCG family.