Class ChengBetaSampler

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

public class ChengBetaSampler extends SamplerBase implements SharedStateContinuousSampler
Sampling from a beta distribution.

Uses Cheng's algorithms for beta distribution sampling:

 R. C. H. Cheng,
 "Generating beta variates with nonintegral shape parameters",
 Communications of the ACM, 21, 317-322, 1978.
 

Sampling uses UniformRandomProvider.nextDouble().

Since:
1.0
  • Field Details

    • LN_4

      private static final double LN_4
      Natural logarithm of 4.
    • delegate

      private final SharedStateContinuousSampler delegate
      The appropriate beta sampler for the parameters.
  • Constructor Details

    • ChengBetaSampler

      public ChengBetaSampler(UniformRandomProvider rng, double alpha, double beta)
      Creates a sampler instance.
      Parameters:
      rng - Generator of uniformly distributed random numbers.
      alpha - Distribution first shape parameter.
      beta - Distribution second shape parameter.
      Throws:
      IllegalArgumentException - if alpha <= 0 or beta <= 0
    • ChengBetaSampler

      private ChengBetaSampler(SharedStateContinuousSampler delegate)
      Parameters:
      delegate - Beta sampler.
  • Method Details