Class BinomialRNG
java.lang.Object
dev.nm.stat.random.rng.univariate.BinomialRNG
- All Implemented Interfaces:
RandomNumberGenerator
,Seedable
This random number generator samples from the binomial distribution.
The R equivalent class are
dbinom, pbinom, qbinom, rbinom
.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBinomialRNG
(int n, double p) Construct a random number generator to sample from the binomial distribution.BinomialRNG
(int n, double p, RandomLongGenerator uniform) Construct a random number generator to sample from the binomial distribution. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Get the next randomdouble
.void
seed
(long... seeds) Seed the random number/vector/scenario generator to produce repeatable experiments.
-
Constructor Details
-
BinomialRNG
Construct a random number generator to sample from the binomial distribution.- Parameters:
n
- the number of trials, a natural numberp
- the success probability in each trial, [0, 1]uniform
- a uniform random number generator
-
BinomialRNG
public BinomialRNG(int n, double p) Construct a random number generator to sample from the binomial distribution.- Parameters:
n
- the number of trials, a natural numberp
- the success probability in each trial, [0, 1]
-
-
Method Details
-
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
-