Class Cheng1978

java.lang.Object
dev.nm.stat.random.rng.univariate.beta.Cheng1978
All Implemented Interfaces:
RandomBetaGenerator, RandomNumberGenerator, Seedable

public class Cheng1978 extends Object implements RandomBetaGenerator
Cheng, 1978, is a new rejection method for generating beta variates. The method is compared with previously published methods both theoretically and through computer timings. It is suggested that the method has advantages in both speed and programming simplicity over previous methods, especially for "difficult" combinations of parameter values.
See Also:
    • "R. C. H. Cheng, "Generating beta variates with nonintegral shape parameters," Communications of the ACM 21, 317-322. 1978."
    • "http://svn.r-project.org/R/trunk/src/nmath/rbeta.c"
  • Constructor Summary

    Constructors
    Constructor
    Description
    Cheng1978(double aa, double bb)
    Constructs a random number generator to sample from the beta distribution.
    Cheng1978(double aa, double bb, RandomLongGenerator uniform)
    Constructs a random number generator to sample from the beta distribution.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Get the next random double.
    void
    seed(long... seeds)
    Seed the random number/vector/scenario generator to produce repeatable experiments.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Cheng1978

      public Cheng1978(double aa, double bb, RandomLongGenerator uniform)
      Constructs a random number generator to sample from the beta distribution.
      Parameters:
      aa - the degree of freedom
      bb - the degree of freedom
      uniform - a uniform random number generator
    • Cheng1978

      public Cheng1978(double aa, double bb)
      Constructs a random number generator to sample from the beta distribution.
      Parameters:
      aa - the degree of freedom
      bb - the degree of freedom
  • Method Details

    • seed

      public void seed(long... seeds)
      Description copied from interface: Seedable
      Seed the random number/vector/scenario generator to produce repeatable experiments.
      Specified by:
      seed in interface Seedable
      Parameters:
      seeds - the seeds
    • nextDouble

      public double nextDouble()
      Description copied from interface: RandomNumberGenerator
      Get the next random double.
      Specified by:
      nextDouble in interface RandomNumberGenerator
      Returns:
      the next random number