Class PoissonDist

Class Documentation

class PoissonDist

Poisson distribution.

For means below 12, deviates are drawn by multiplying uniform deviates together until their product falls to exp(-mean) or below. For larger means, they are drawn by the rejection method of Devroye (1986, Non-Uniform Random Variate Generation, Springer-Verlag, Ch. X, Sects. 3.3 & 3.4, including its errata), which also draws from an internal unit NormalDist. Both reproduce libstdc++’s std::poisson_distribution<unsigned int>, including its choice of constants, the ordering of its branches, and its handling of the case x = 1 (libstdc++ bug 83237).

Public Functions

inline explicit PoissonDist(const double mean)

Construct a PoissonDist.

Parameters:

mean – The mean of the distribution; must be non-negative and finite

Throws:

std::invalid_argument – if mean is negative or not finite

inline auto operator()(RngType &rng) -> unsigned int

Draw a deviate.

Parameters:

rng – The rng engine to draw from

Returns:

A Poisson deviate