umontreal.iro.lecuyer.randvar
Class NegativeBinomialConvolutionGen
java.lang.Object
umontreal.iro.lecuyer.randvar.RandomVariateGen
umontreal.iro.lecuyer.randvar.RandomVariateGenInt
umontreal.iro.lecuyer.randvar.NegativeBinomialGen
umontreal.iro.lecuyer.randvar.NegativeBinomialConvolutionGen
public class NegativeBinomialConvolutionGen
- extends NegativeBinomialGen
Implements negative binomial random variate generators by
the convolution method.
The method generates n geometric variates with probability p
and adds them up.
The algorithm is slow if n is large.
A local copy of the parameters n and p is maintained in this class.
Method Summary |
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)
|
NegativeBinomialConvolutionGen
public NegativeBinomialConvolutionGen(RandomStream s,
NegativeBinomialDist dist)
- Creates a new generator for the distribution dist, using
stream s.
nextInt
public int nextInt()
- Description copied from class:
RandomVariateGenInt
- Generates a random number (an integer) from the discrete
distribution contained in this object.
By default, this method uses inversion by calling the inverseF
method of the distribution object.
Alternative generating methods are provided in subclasses.
- Overrides:
nextInt
in class NegativeBinomialGen
- Returns:
- the generated value
nextInt
public static int nextInt(RandomStream s,
int n,
double p)
To submit a bug or ask questions, send an e-mail to
Pierre L'Ecuyer.