public class RandomVariateGenInt extends RandomVariateGen
RandomVariateGen, except that the generators
produce integers, via the nextInt method, instead of real numbers.| Constructor and Description |
|---|
RandomVariateGenInt(RandomStream s,
DiscreteDistributionInt dist)
Creates a new random variate generator for the discrete
distribution dist, using stream s.
|
| Modifier and Type | Method and Description |
|---|---|
DiscreteDistributionInt |
getDistribution()
Returns the
DiscreteDistributionInt used by this generator. |
void |
nextArrayOfInt(int[] v,
int start,
int n)
Generates n random numbers from the discrete distribution
contained in this object.
|
int |
nextInt()
Generates a random number (an integer) from the discrete
distribution contained in this object.
|
getStream, nextArrayOfDouble, nextDouble, setStreampublic RandomVariateGenInt(RandomStream s, DiscreteDistributionInt dist)
s - random stream used for generating uniformsdist - discrete distribution object of the generated valuespublic int nextInt()
public void nextArrayOfInt(int[] v,
int start,
int n)
nextInt() n
times, but one can reimplement it in subclasses for better efficiency.v - array into which the variates will be storedstart - starting index, in v, of the new variatesn - number of variates being generatedpublic DiscreteDistributionInt getDistribution()
DiscreteDistributionInt used by this generator.getDistribution in class RandomVariateGenTo submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.