SFC (Small Fast Chaotic)
Small chaotic generators from the PractRand test suite
Overview
SFC32 and SFC64 are small, fast, nonlinear pseudorandom number generators designed by Chris Doty-Humphrey, author of the PractRand statistical test suite. They pass extensive statistical testing and are a common choice where speed matters, but they are not cryptographic.
Each SFC generator keeps three working words and a counter. Every step adds, shifts and rotates the words into one another and increments the counter. The nonlinear mixing makes the period unknown in general, but the counter guarantees a minimum period of 2^32 or 2^64 for any seed, and in practice periods are vastly longer. Its state is small enough to keep in registers.
Two variants are present: sfc32, operating on 32-bit words with a 128-bit state, and sfc64, operating on 64-bit words with a 256-bit state. SFC64 is one of the bit generators offered by NumPy. Both are suitable for parallel use when each instance is seeded independently, for example with SplitMix64. The 32-bit version is especially fast on platforms without efficient 64-bit multiplication, since SFC uses no multiplication at all.
How it works
- Seed the three words and set the counter, then discard a few initial outputs.
- Compute output as a + b + counter.
- Update a from b and a right shift of b, b from c and a left shift of c, and c by rotating and adding the output.
- Increment the counter.
Security notes
Not cryptographically secure: the small state and simple update allow an attacker to recover the state and predict outputs. Do not use for keys, nonces or tokens.
Typical uses
Variants in NextSSL
2Frequently asked questions
Which SFC (Small Fast Chaotic) variants does NextSSL include?
NextSSL registers 2 SFC (Small Fast Chaotic) variants: sfc32, sfc64.
Other non-cryptographic prngs
All 26Related
Permuted congruential generators: LCG state with a permutation on output
SplitMix64Counter-based 64-bit generator, widely used to seed other generators
xoshiro / xoroshiroFast linear generators from Blackman and Vigna for simulation, not for secrets
Operating system RNGThe kernel's cryptographically secure random number generator, the right default