univariate

poisson

Generator for a Poisson random variable

The numpy generator is used as default

class ALGORITHM(value)[source]

Bases: Enum

Poisson generator algorithms

NUMPY = 1
KNUTH = 2
class Poisson(lam: Union[int, float], algorithm: ALGORITHM = ALGORITHM.NUMPY)[source]

Bases: Sampling

Poisson random variate

__init__(lam: Union[int, float], algorithm: ALGORITHM = ALGORITHM.NUMPY)[source]
Parameters
  • lam – rate/intensity parameter

  • algorithm

    chosen algorithm (numpy by default)

sample(size: int = 1) ndarray[Any, dtype[float]][source]

sample a random variable corresponding the distribution in scope

Parameters

size – size of the sampling vector

Returns

the array of simulated variables

cost()[source]
Returns

the computing cost of the algorithm for generating the random variable the cost will usually correspond to the number of generated uniform random variables

reset_sampling_cost()[source]

reset the simulation cost to 0

uniform

Generator for standard uniform random variables

Numpy is used here, the generator returns random floats in the half-open interval [0.0, 1.0) see https://docs.scipy.org/doc/numpy/reference/generated/numpy.random.random_sample.html#numpy.random.random_sample

class Uniform(low: float = 0.0, high: float = 1.0)[source]

Bases: Sampling

Uniform random variate generator

__init__(low: float = 0.0, high: float = 1.0) None[source]
sample(size: int = 1) array[source]

sample a random variable corresponding the distribution in scope

Parameters

size – size of the sampling vector

Returns

the array of simulated variables