DiscreteSampler
, SharedStateDiscreteSampler
, SharedStateSampler<SharedStateDiscreteSampler>
public class LargeMeanPoissonSampler extends java.lang.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:
UniformRandomProvider.nextLong()
UniformRandomProvider.nextDouble()
Constructor | Description |
---|---|
LargeMeanPoissonSampler(org.apache.commons.rng.UniformRandomProvider rng,
double mean) |
Modifier and Type | Method | Description |
---|---|---|
static SharedStateDiscreteSampler |
of(org.apache.commons.rng.UniformRandomProvider rng,
double mean) |
Creates a new Poisson distribution sampler.
|
int |
sample() |
Creates a sample.
|
java.lang.String |
toString() |
|
SharedStateDiscreteSampler |
withUniformRandomProvider(org.apache.commons.rng.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.
|
public LargeMeanPoissonSampler(org.apache.commons.rng.UniformRandomProvider rng, double mean)
rng
- Generator of uniformly distributed random numbers.mean
- Mean.java.lang.IllegalArgumentException
- if mean < 1
or
mean > 0.5 *
Integer.MAX_VALUE
.public int sample()
sample
in interface DiscreteSampler
public java.lang.String toString()
toString
in class java.lang.Object
public SharedStateDiscreteSampler withUniformRandomProvider(org.apache.commons.rng.UniformRandomProvider rng)
withUniformRandomProvider
in interface SharedStateSampler<SharedStateDiscreteSampler>
rng
- Generator of uniformly distributed random numbers.public static SharedStateDiscreteSampler of(org.apache.commons.rng.UniformRandomProvider rng, double mean)
rng
- Generator of uniformly distributed random numbers.mean
- Mean.java.lang.IllegalArgumentException
- if mean < 1
or mean > 0.5 *
Integer.MAX_VALUE
.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.