Class PoissonSampler

java.lang.Object
org.apache.commons.rng.sampling.distribution.SamplerBase
org.apache.commons.rng.sampling.distribution.PoissonSampler
All Implemented Interfaces:
DiscreteSampler

public class PoissonSampler
extends SamplerBase
implements DiscreteSampler
Sampler for the Poisson distribution.
  • For small means, a Poisson process is simulated using uniform deviates, as described here. The Poisson process (and hence, the returned value) is bounded by 1000 * mean.
  • For large means, we use the rejection algorithm described in
    Devroye, Luc. (1981). The Computer Generation of Poisson Random Variables
    Computing vol. 26 pp. 197-207.

Sampling uses:

Since:
1.0
  • Constructor Summary

    Constructors 
    Constructor Description
    PoissonSampler​(UniformRandomProvider rng, double mean)  
  • Method Summary

    Modifier and Type Method Description
    int sample()
    Creates a sample.
    java.lang.String toString()

    Methods inherited from class org.apache.commons.rng.sampling.distribution.SamplerBase

    nextDouble, nextInt, nextInt, nextLong

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PoissonSampler

      public PoissonSampler​(UniformRandomProvider rng, double mean)
      Parameters:
      rng - Generator of uniformly distributed random numbers.
      mean - Mean.
      Throws:
      java.lang.IllegalArgumentException - if mean <= 0 or mean > Integer.MAX_VALUE.
  • Method Details