Legend:
Library
Module
Module type
Parameter
Class
Class type
ChaCha is a 64-bit PRNG that uses a counter-based design based on the ChaCha cipher. Instances using different values of the key produce sequences. ChaCha has a period of 2^{128} and supports arbitrary advancing and jumping the sequence in increments of 2^{64}. These features allow multiple non-overlapping sequences to be generated.
The ChaCha state vector consists of a 16-element array of uint32 that capture buffered draws from the distribution, an 8-element array of uint32s holding the seed, and a 2-element array of uint64 that holds the 128-bit counter (low, high). The elements of the seed are the value provided by the user. Typical values for number of rounds are 4, 8, 12, or 20 (for high security).
next_bounded_uint64 b t Generates a random unsigned 64-bit integer in the interval [0, b). It returns the integer as well as the state of the generator advanced forward. To generate an integer in the range [a, b), one should generate an integer in [0, b - a) using next_bounded_uint64 (b - a) t and then add a to the resulting integer to get the output in the desired range.
initialize s Returns the initial state of the generator. The random stream is determined by the initialization of the seed sequence s of SeedSequence.t type.
initialize_full seedseq counter rounds initializes the state of the ChaCha bitgenerator; where seedseq is a SeedSequence.t used to initialize the PRNG's key array, counter is a 2-tuple used to initialize the 128-bit counter, and rounds is the number of rounds to use. rounds must be non-negative, even and greater than 2, else an Invalid_argument exception is raised.