poisson_impl

hormann

Cython code - sphinx code generation fails, to be reviewed.

knuth

Simple acceptance-rejectance algorithm for generating Poisson random variable by Donald Knuth

see https://en.wikipedia.org/wiki/Poisson_distribution#Generating_Poisson-distributed_random_variables

class Knuth(lam: int)[source]

Bases: Sampling

Knuth algorithm for generating Poisson random variable

__init__(lam: int)[source]
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

sample_one()[source]
sample(size: int = 1)[source]

sample a random variable corresponding the distribution in scope

Parameters

size – size of the sampling vector

Returns

the array of simulated variables

numpyimpl

Numpy implement the Poisson random generator as described in Hormann W (1993) “The transformed rejection method for generating Poisson random variables”

class PoissonNumpy(lam: float)[source]

Bases: Sampling

Poisson generator from numpy

__init__(lam: float)[source]
sample(size: int = 1)[source]

sample a random variable corresponding the distribution in scope

Parameters

size – size of the sampling vector

Returns

the array of simulated variables