Extended Generator

The ExtendedGenerator provides access to a small number of distributions that are not present in NumPy. The default bit generator used by ExtendedGenerator is PCG64. The bit generator can be changed by passing an instantized bit generator to ExtendedGenerator. It is also possible to share a bit generator with an instance of NumPy’s numpy.random.Generator.

class randomgen.generator.ExtendedGenerator(bit_generator=None)

Additional random value generator using a bit generator source.

ExtendedGenerator exposes methods for generating random numbers from some distributions that are not in numpy.random.Generator.

bit_generatorBitGenerator, optional

Bit generator to use as the core generator. If none is provided, uses PCG64(variant=”cm-dxsm”).

See also


The primary generator of random variates.


>>> from randomgen import ExtendedGenerator
>>> rg = ExtendedGenerator()
>>> rg.complex_normal()
-0.203 + .936j  # random

Using a specific generator

>>> from randomgen import MT19937
>>> rg = ExtendedGenerator(MT19937())

Share a bit generator with numpy

>>> from numpy.random import Generator, PCG64
>>> pcg = PCG64()
>>> gen = Generator(pcg)
>>> eg = ExtendedGenerator(pcg)

Seed and State Manipulation


Get or set the bit generator's state


Gets the bit generator instance used by the generator


uintegers([size, bits])

Return random unsigned integers

random([size, dtype, out])

Return random floats in the half-open interval [0.0, 1.0).

complex_normal([loc, gamma, relation, size])

Draw random samples from a complex normal (Gaussian) distribution.

multivariate_normal(mean, cov[, size, ...])

Draw random samples from a multivariate normal distribution.

multivariate_complex_normal(loc[, gamma, ...])

Draw random samples from a multivariate complex normal (Gaussian) distribution.

standard_wishart(df, dim[, size])

Draw samples from the Standard Wishart and Pseudo-Wishart distributions

wishart(df, scale[, size, check_valid, tol, ...])

Draw samples from the Wishart and pseudo-Wishart distributions.