Class MarsagliaTsangWangDiscreteSampler.Poisson

java.lang.Object
org.apache.commons.rng.sampling.distribution.MarsagliaTsangWangDiscreteSampler.Poisson
Enclosing class:
MarsagliaTsangWangDiscreteSampler

public static final class MarsagliaTsangWangDiscreteSampler.Poisson extends Object
Create a sampler for the Poisson distribution.
Since:
1.3
  • Method Details

    • of

      public static SharedStateDiscreteSampler of(UniformRandomProvider rng, double mean)
      Creates a sampler for the Poisson distribution.

      Any probability less than 2-31 will not be observed in samples.

      Storage requirements depend on the tabulated probability values. Example storage requirements are listed below.

      mean      table size     kB
      0.25      882            0.88
      0.5       1135           1.14
      1         1200           1.20
      2         1451           1.45
      4         1955           1.96
      8         2961           2.96
      16        4410           4.41
      32        6115           6.11
      64        8499           8.50
      128       11528          11.53
      256       15935          31.87
      512       20912          41.82
      1024      30614          61.23
      

      Note: Storage changes to 2 bytes per index between mean=128 and mean=256.

      Parameters:
      rng - Generator of uniformly distributed random numbers.
      mean - Mean.
      Returns:
      Sampler.
      Throws:
      IllegalArgumentException - if mean <= 0 or mean > 1024.