ContinuousSampler
public class AhrensDieterMarsagliaTsangGammaSampler extends SamplerBase implements ContinuousSampler
0 < theta < 1
:
Ahrens, J. H. and Dieter, U., Computer methods for sampling from gamma, beta, Poisson and binomial distributions, Computing, 12, 223-246, 1974.
theta >= 1
:
Marsaglia and Tsang, A Simple Method for Generating Gamma Variables. ACM Transactions on Mathematical Software, Volume 26 Issue 3, September, 2000.
Constructor | Description |
---|---|
AhrensDieterMarsagliaTsangGammaSampler(org.apache.commons.rng.UniformRandomProvider rng,
double alpha,
double theta) |
Modifier and Type | Method | Description |
---|---|---|
double |
sample() |
Creates a sample.
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
nextDouble, nextInt, nextInt, nextLong
public AhrensDieterMarsagliaTsangGammaSampler(org.apache.commons.rng.UniformRandomProvider rng, double alpha, double theta)
rng
- Generator of uniformly distributed random numbers.alpha
- Alpha parameter of the distribution.theta
- Theta parameter of the distribution.public double sample()
sample
in interface ContinuousSampler
public java.lang.String toString()
toString
in class SamplerBase
Copyright © 2016–2018 The Apache Software Foundation. All rights reserved.