25package umontreal.ssj.randvar;
27import umontreal.ssj.probdist.*;
28import umontreal.ssj.rng.*;
63 for (
int i = 0; i < n; i++) {
64 double unif = stream.nextDouble();
78 throw new IllegalArgumentException(
"n <= 0");
80 throw new IllegalArgumentException(
"p must be in [0,1]");
81 return convolution(s, n, p);
84 private static int convolution(
RandomStream stream,
int n,
double p) {
86 for (
int i = 0; i < n; i++) {
Extends the class DiscreteDistributionInt for the binomial distribution slaw00a (page 321) with para...
BinomialConvolutionGen(RandomStream s, int n, double p)
Creates a binomial random variate generator with parameters.
int nextInt()
Generates a random number (an integer) from the discrete distribution contained in this object.
static int nextInt(RandomStream s, int n, double p)
Generates a new integer from the binomial distribution with parameters.
BinomialConvolutionGen(RandomStream s, BinomialDist dist)
Creates a random variate generator for the binomial distribution dist and stream s.
BinomialGen(RandomStream s, int n, double p)
Creates a binomial random variate generator with parameters and , using stream s.
void setParams(int n, double p)
Sets the parameter and of this object.
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...
double nextDouble()
Returns a (pseudo)random number from the uniform distribution over the interval , using this stream,...