public class AhrensDieterMarsagliaTsangGammaSampler extends SamplerBase implements ContinuousSampler
0 < shape < 1
:
Ahrens, J. H. and Dieter, U., Computer methods for sampling from gamma, beta, Poisson and binomial distributions, Computing, 12, 223-246, 1974.
shape >= 1
:
Marsaglia and Tsang, A Simple Method for Generating Gamma Variables. ACM Transactions on Mathematical Software, Volume 26 Issue 3, September, 2000.
Constructor and Description |
---|
AhrensDieterMarsagliaTsangGammaSampler(UniformRandomProvider rng,
double alpha,
double theta) |
Modifier and Type | Method and Description |
---|---|
double |
sample()
Creates a sample.
|
String |
toString() |
nextDouble, nextInt, nextInt
public AhrensDieterMarsagliaTsangGammaSampler(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 String toString()
toString
in class SamplerBase
Copyright © 2016 The Apache Software Foundation. All rights reserved.