generatorsrandom.py¶
- class IGenRandom[source]¶
Bases:
ABC
Interface (abstract base class) for wrapping numpy random number generation to allow probability distribution parameters to be specified in the initialiser whereas the generation of random numbers has a common method that just takes the require shape to return. Allows for easy subsitution of different probability distributions.
- abstractmethod generate(shape)[source]¶
Abstract method. Generates an array of random numbers with the shape specified by the input.
- Parameters:
shape (
tuple[int,...]
) – Shape of the array of random numbers to be returned.- Returns:
np.ndarray
– Array of random numbers with shape specified by the input shape.
- class GenNormal(std=1.0, mean=0.0, seed=None)[source]¶
Bases:
IGenRandom
Class wrapping the numpy normal random number generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.
- __init__(std=1.0, mean=0.0, seed=None)[source]¶
- Parameters:
std (
float
, optional) – Standard deviation of the normal distribution to sample, by default 1.0mean (
float
, optional) – Mean of the normal distribution to sample, by default 0.0seed (
int | None
, optional) – Optional seed for the random generator to allow for reproducibility and testing, by default None
- class GenLogNormal(std=1.0, mean=0.0, seed=None)[source]¶
Bases:
IGenRandom
Class wrapping the numpy lognormal random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.
- __init__(std=1.0, mean=0.0, seed=None)[source]¶
- Parameters:
std (
float
, optional) – Standard deviation of the normal distribution to sample, by default 1.0mean (
float
, optional) – Mean of the normal distribution to sample, by default 0.0seed (
int | None
, optional) – Optional seed for the random generator to allow for reproducibility and testing, by default None
- class GenUniform(low=-1.0, high=1.0, seed=None)[source]¶
Bases:
IGenRandom
Class wrapping the numpy uniform random number generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.
- __init__(low=-1.0, high=1.0, seed=None)[source]¶
- Parameters:
low (
float
, optional) – Lower bound of the uniform dsitribution., by default -1.0high (
float
, optional) – Upper bound of the uniform distribution, by default 1.0seed (
int | None
, optional) – Optional seed for the random generator to allow for reproducibility and testing, by default None
- class GenExponential(scale=1.0, seed=None)[source]¶
Bases:
IGenRandom
Class wrapping the numpy exponential random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.
- class GenChiSquare(dofs, seed=None)[source]¶
Bases:
IGenRandom
Class wrapping the numpy chi square random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.
- class GenDirichlet(alpha, seed=None)[source]¶
Bases:
IGenRandom
Class wrapping the numpy dirichlet random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.
- class GenF(dofs, seed=None)[source]¶
Bases:
IGenRandom
Class wrapping the numpy F distribution random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.
- class GenGamma(shape, scale=1.0, seed=None)[source]¶
Bases:
IGenRandom
Class wrapping the numpy gamma random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.
- __init__(shape, scale=1.0, seed=None)[source]¶
- Parameters:
shape (
float
) – Shape parameter of the gamma distribution, must be greater than zeroscale (
float
, optional) – Scale parameter of the gamma distribution which must be greater than zero, by default 1.0seed (
int | None
, optional) – Optional seed for the random generator to allow for reproducibility and testing, by default None
- class GenStandardT(dofs, seed=None)[source]¶
Bases:
IGenRandom
Class wrapping the numpy t distribution random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.
- class GenBeta(a, b, seed=None)[source]¶
Bases:
IGenRandom
Class wrapping the numpy beta distribution random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.
- __init__(a, b, seed=None)[source]¶
- Parameters:
a (
float
) – Alpha parameter of the distribution which must be greater than zerob (
float
) – Beta parameter of the distribution which must be greater than zeroseed (
int | None
, optional) – Optional seed for the random generator to allow for reproducibility and testing, by default None
- class GenTriangular(left=-1.0, mode=0.0, right=1.0, seed=None)[source]¶
Bases:
IGenRandom
Class wrapping the numpy triangular random generator. Implements the IGeneratorRandom interface to allow for interchangeability with other random number generators.
- __init__(left=-1.0, mode=0.0, right=1.0, seed=None)[source]¶
- Parameters:
left (
float
, optional) – Left (min) corner of the triangular distribution, by default -1.0mode (
float
, optional) – Central peak of the triangular distribution, by default 0.0right (
float
, optional) – Right (max) corner of the triangular distribution , by default 1.0seed (
int | None
, optional) – Optional seed for the random generator to allow for reproducibility and testing, by default None