Entropy From Iteration, Indirection, Xor (EFIIX) Generator

class randomgen.efiix64.EFIIX64(seed=None)

Container for the EFIIX64x384 pseudo-random number generator.


Entropy initializing the pseudo-random number generator. Can be an integer in [0, 2**64), array of integers in [0, 2**64), a SeedSequence instance or None (the default). If seed is None, then data is read from /dev/urandom (or the Windows analog) if available. If unavailable, a hash of the time and process ID is used.


Lock instance that is shared so that the same bit git generator can be used in multiple Generators without corrupting the state. Code that generates values from a bit generator should hold the bit generator’s lock.




The SeedSequence instance used to initialize the generator if mode is “sequence” or is seed is a SeedSequence. None if mode is “legacy”.


{None, SeedSequence}


EFIIX64 (also known as efiix64x384) is written by Chris Doty-Humphrey. It is a 64-bit PRNG that uses a set of tables generate random values. This produces a fast PRNG with statistical quality similar to cryptographic generators but faster [1].

EFIIX64 provides a capsule containing function pointers that produce doubles, and unsigned 32 and 64- bit integers. These are not directly consumable in Python and must be consumed by a Generator or similar object that supports low-level access.

State and Seeding

The EFIIX64 state vector consists of a 16-element array of 64-bit unsigned integers and a 32-element array of 64-bit unsigned integers. In addition, 3 constant values and a counter are used in the update.

EFIIX64 is seeded using an integer, a sequence of integer or a SeedSequence. If the seed is not SeedSequence, the seed values are passed to a SeedSequence which is then used to produce 4 64-bit unsigned integer values which are used to Seed the generator

Compatibility Guarantee

EFIIX64 makes a guarantee that a fixed seed will always produce the same random integer stream.


>>> from numpy.random import Generator
>>> from randomgen import EFIIX64
>>> rg = Generator(EFIIX64(1234))
>>> rg.standard_normal()
0.123  # random

Parallel Features

EFIIX64 can be used in parallel when combined with a SeedSequence using spawn.

>>> from randomgen import SeedSequence
>>> ss = SeedSequence(8509285875904376097169743623867)
>>> bit_gens = [EFIIX64(child) for child in ss.spawn(1024)]


Seeding and State


Seed the generator


Get or set the PRNG state



CFFI interface


ctypes interface


random_raw([size, output])

Return randoms as generated by the underlying BitGenerator