Class BinomialRNG
- java.lang.Object
-
- dev.nm.stat.random.rng.univariate.BinomialRNG
-
- All Implemented Interfaces:
RandomNumberGenerator,Seedable
public class BinomialRNG extends Object implements RandomNumberGenerator
This random number generator samples from the binomial distribution. The R equivalent class aredbinom, pbinom, qbinom, rbinom.- See Also:
- Wikipedia: Binomial distribution
-
-
Constructor Summary
Constructors Constructor Description BinomialRNG(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublenextDouble()Get the next randomdouble.voidseed(long... seeds)Seed the random number/vector/scenario generator to produce repeatable experiments.
-
-
-
Constructor Detail
-
BinomialRNG
public BinomialRNG(int n, double p, RandomLongGenerator uniform)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 Detail
-
seed
public void seed(long... seeds)
Description copied from interface:SeedableSeed the random number/vector/scenario generator to produce repeatable experiments.
-
nextDouble
public double nextDouble()
Description copied from interface:RandomNumberGeneratorGet the next randomdouble.- Specified by:
nextDoublein interfaceRandomNumberGenerator- Returns:
- the next random number
-
-