Class LargeMeanPoissonSampler
java.lang.Object
org.apache.commons.rng.sampling.distribution.LargeMeanPoissonSampler
- All Implemented Interfaces:
DiscreteSampler, SharedStateDiscreteSampler, SharedStateSampler<SharedStateDiscreteSampler>
Sampler for the Poisson distribution.
-
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.
This sampler is suitable for mean >= 40.
Sampling uses:
- Since:
- 1.1
-
Constructor Summary
ConstructorsConstructorDescriptionLargeMeanPoissonSampler(UniformRandomProvider rng, double mean) Create an instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic SharedStateDiscreteSamplerof(UniformRandomProvider rng, double mean) Creates a new Poisson distribution sampler.intsample()Creates anintsample.toString()Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface DiscreteSampler
samples, samples
-
Constructor Details
-
LargeMeanPoissonSampler
Create an instance.- Parameters:
rng- Generator of uniformly distributed random numbers.mean- Mean.- Throws:
IllegalArgumentException- ifmean < 1ormean > 0.5 *Integer.MAX_VALUE.
-
-
Method Details
-
sample
Creates anintsample.- Specified by:
samplein interfaceDiscreteSampler- Returns:
- a sample.
-
toString
-
withUniformRandomProvider
Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.- Specified by:
withUniformRandomProviderin interfaceSharedStateSampler<SharedStateDiscreteSampler>- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
- Since:
- 1.3
-
of
Creates a new Poisson distribution sampler.- Parameters:
rng- Generator of uniformly distributed random numbers.mean- Mean.- Returns:
- the sampler
- Throws:
IllegalArgumentException- ifmean < 1ormean > 0.5 *Integer.MAX_VALUE.- Since:
- 1.3
-