Class AhrensDieterMarsagliaTsangGammaSampler

java.lang.Object
org.apache.commons.rng.sampling.distribution.SamplerBase
org.apache.commons.rng.sampling.distribution.AhrensDieterMarsagliaTsangGammaSampler
All Implemented Interfaces:
ContinuousSampler, SharedStateContinuousSampler, SharedStateSampler<SharedStateContinuousSampler>

public class AhrensDieterMarsagliaTsangGammaSampler extends SamplerBase implements SharedStateContinuousSampler
Sampling from the gamma distribution.
  • For 0 < alpha < 1:
    Ahrens, J. H. and Dieter, U., Computer methods for sampling from gamma, beta, Poisson and binomial distributions, Computing, 12, 223-246, 1974.
  • For alpha >= 1:
    Marsaglia and Tsang, A Simple Method for Generating Gamma Variables. ACM Transactions on Mathematical Software, Volume 26 Issue 3, September, 2000.

Sampling uses:

Since:
1.0
See Also:
  • Field Details

  • Constructor Details

    • AhrensDieterMarsagliaTsangGammaSampler

      public AhrensDieterMarsagliaTsangGammaSampler(UniformRandomProvider rng, double alpha, double theta)
      This instance delegates sampling. Use the factory method of(UniformRandomProvider, double, double) to create an optimal sampler.
      Parameters:
      rng - Generator of uniformly distributed random numbers.
      alpha - Alpha parameter of the distribution (this is a shape parameter).
      theta - Theta parameter of the distribution (this is a scale parameter).
      Throws:
      IllegalArgumentException - if alpha <= 0 or theta <= 0
  • Method Details