randomgen.threefry.ThreeFry.seed

ThreeFry.seed(seed=None, counter=None, key=None)

Seed the generator

This method is called when ThreeFry is initialized. It can be called again to re-Seed the generator For details, see ThreeFry.

Parameters:
seed=None

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, data will be read from /dev/urandom (or the Windows analog) if available. If unavailable, a hash of the time and process ID is used.

counter=None

Counter to use in the ThreeFry state. Can be either a Python int in [0, 2**256) or a 4-element uint64 array. If not provided, the counter is initialized at 0.

key=None

Key to use in the ThreeFry state. Unlike seed, which is run through another RNG before use, the value in key is directly set. Can be either a Python int in [0, 2**128) or a 2-element uint64 array. key and seed cannot both be used.

Raises:

ValueError – If values are out of range for the PRNG or If seed and key are both set.

Notes

The two representation of the counter and key are related through array[i] = (value // 2**(64*i)) % 2**64.