|
Infinity Engine v0.6.20
C++ API Documentation
|
Platform-independent Poisson distribution. More...
#include <PRNGDistribution.hpp>
Classes | |
| struct | param_type |
| Parameter set for the distribution. More... | |
Public Types | |
| using | result_type = IntType |
| The type of values produced by the distribution. | |
Public Member Functions | |
| PoissonDistribution () | |
| Default constructor. Creates Poisson distribution with mean=1.0. | |
| PoissonDistribution (double mean) | |
| Constructs a Poisson distribution with specified mean. | |
| PoissonDistribution (const param_type ¶m) | |
| Constructs from a parameter set. | |
| void | reset () |
| Resets the distribution state. | |
| double | mean () const |
| Gets the mean (rate) parameter. | |
| param_type | param () const |
| Gets the current parameter set. | |
| void | param (const param_type ¶m) |
| Sets new parameters for the distribution. | |
| result_type | min () const |
| Gets the minimum value that can be generated (0). | |
| result_type | max () const |
| Gets the theoretical maximum value (unbounded). | |
| template<typename Generator > | |
| result_type | operator() (Generator &g) |
| Generates the next random value using stored parameters. | |
| template<typename Generator > | |
| result_type | operator() (Generator &g, const param_type ¶m) |
| Generates the next random value using provided parameters. | |
Friends | |
| bool | operator== (const PoissonDistribution &lhs, const PoissonDistribution &rhs) |
| bool | operator!= (const PoissonDistribution &lhs, const PoissonDistribution &rhs) |
Platform-independent Poisson distribution.
Produces integer counts of events occurring in a fixed interval when events happen independently at a constant average rate. Uses normal approximation for large means, Knuth's algorithm for small means.
The Poisson distribution is fundamental for modeling count data where events occur randomly over time or space: number of calls per hour, defects per item, particles detected per second, customers arriving per minute, or any process where events occur randomly at a constant average rate.
| IntType | Integer type for the result |
Example usage:
| using Infinity::Engine::PoissonDistribution< IntType >::result_type = IntType |
The type of values produced by the distribution.
|
inline |
Default constructor. Creates Poisson distribution with mean=1.0.
|
inlineexplicit |
Constructs a Poisson distribution with specified mean.
| mean | Mean number of events (rate parameter) |
|
inlineexplicit |
Constructs from a parameter set.
| param | The distribution parameters |
|
inline |
Gets the theoretical maximum value (unbounded).
|
inline |
Gets the mean (rate) parameter.
|
inline |
Gets the minimum value that can be generated (0).
|
inline |
Generates the next random value using stored parameters.
| Generator | The random number generator type (e.g., PRNG) |
| g | The random number generator |
|
inline |
Generates the next random value using provided parameters.
Uses two methods depending on the mean:
Knuth's method (mean < 10): Simulates the Poisson process by generating uniform random values and multiplying them until their product falls below e^(-mean). The count of multiplications gives the Poisson value.
Algorithm: Generate U1, U2, ... ~ Uniform(0,1) Count k such that U1*U2*...*Uk > e^(-mean) Return k-1
| Generator | The random number generator type (e.g., PRNG) |
| g | The random number generator |
| param | The distribution parameters to use for this generation |
|
inline |
Gets the current parameter set.
|
inline |
Sets new parameters for the distribution.
Recreates the normal distribution for approximation if needed.
| param | The new distribution parameters |
|
inline |
Resets the distribution state.
Resets the underlying normal distribution if it's being used for approximation.
|
friend |
|
friend |