public class LargeMeanPoissonSampler extends Object implements SharedStateDiscreteSampler
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:
Constructor and Description |
---|
LargeMeanPoissonSampler(UniformRandomProvider rng,
double mean) |
Modifier and Type | Method and Description |
---|---|
static SharedStateDiscreteSampler |
of(UniformRandomProvider rng,
double mean)
Creates a new Poisson distribution sampler.
|
int |
sample()
Creates an
int sample. |
String |
toString() |
SharedStateDiscreteSampler |
withUniformRandomProvider(UniformRandomProvider rng)
Create a new instance of the sampler with the same underlying state using the given
uniform random provider as the source of randomness.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
samples, samples
public LargeMeanPoissonSampler(UniformRandomProvider rng, double mean)
rng
- Generator of uniformly distributed random numbers.mean
- Mean.IllegalArgumentException
- if mean < 1
or
mean > 0.5 *
Integer.MAX_VALUE
.public int sample()
int
sample.sample
in interface DiscreteSampler
public SharedStateDiscreteSampler withUniformRandomProvider(UniformRandomProvider rng)
withUniformRandomProvider
in interface SharedStateSampler<SharedStateDiscreteSampler>
rng
- Generator of uniformly distributed random numbers.public static SharedStateDiscreteSampler of(UniformRandomProvider rng, double mean)
rng
- Generator of uniformly distributed random numbers.mean
- Mean.IllegalArgumentException
- if mean < 1
or mean > 0.5 *
Integer.MAX_VALUE
.Copyright © 2016–2022 The Apache Software Foundation. All rights reserved.