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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
nextDouble()
Get the next randomdouble
.void
seed(long... seeds)
Seed the random number/vector/scenario generator to produce repeatable experiments.
-
-
-
Constructor Detail
-
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 freedombb
- the degree of freedomuniform
- 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 freedombb
- the degree of freedom
-
-
Method Detail
-
seed
public void seed(long... seeds)
Description copied from interface:Seedable
Seed the random number/vector/scenario generator to produce repeatable experiments.
-
nextDouble
public double nextDouble()
Description copied from interface:RandomNumberGenerator
Get the next randomdouble
.- Specified by:
nextDouble
in interfaceRandomNumberGenerator
- Returns:
- the next random number
-
-