Entropy From Iteration, Indirection, Xor (EFIIX) Generator¶
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”.
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 .
EFIIX64provides 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
Generatoror similar object that supports low-level access.
State and Seeding
EFIIX64state 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.
EFIIX64is 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
EFIIX64makes 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
EFIIX64can be used in parallel when combined with a
>>> 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
Return randoms as generated by the underlying BitGenerator