SSJ
3.3.1
Stochastic Simulation in Java
|
This is the base class for all generators of discrete random variates over the set of integers. More...
Public Member Functions | |
RandomVariateGenInt (RandomStream s, DiscreteDistributionInt dist) | |
Creates a new random variate generator for the discrete distribution dist , using stream s . More... | |
int | nextInt () |
Generates a random number (an integer) from the discrete distribution contained in this object. More... | |
void | nextArrayOfInt (int[] v, int start, int n) |
Generates n random numbers from the discrete distribution contained in this object. More... | |
int [] | nextArrayOfInt (int n) |
Generates n random numbers from the discrete distribution contained in this object, and returns them in a new array of size n . More... | |
DiscreteDistributionInt | getDistribution () |
Returns the umontreal.ssj.probdist.DiscreteDistributionInt used by this generator. More... | |
Public Member Functions inherited from RandomVariateGen | |
RandomVariateGen (RandomStream s, Distribution dist) | |
Creates a new random variate generator from the distribution dist , using stream s . More... | |
double | nextDouble () |
Generates a random number from the continuous distribution contained in this object. More... | |
void | nextArrayOfDouble (double[] v, int start, int n) |
Generates n random numbers from the continuous distribution contained in this object. More... | |
double [] | nextArrayOfDouble (int n) |
Generates n random numbers from the continuous distribution contained in this object, and returns them in a new array of size n . More... | |
RandomStream | getStream () |
Returns the umontreal.ssj.rng.RandomStream used by this generator. More... | |
void | setStream (RandomStream stream) |
Sets the umontreal.ssj.rng.RandomStream used by this generator to stream . | |
Distribution | getDistribution () |
Returns the umontreal.ssj.probdist.Distribution used by this generator. More... | |
String | toString () |
Returns a String containing information about the current generator. | |
Additional Inherited Members | |
Protected Attributes inherited from RandomVariateGen | |
RandomStream | stream |
Distribution | dist |
This is the base class for all generators of discrete random variates over the set of integers.
Similar to RandomVariateGen, except that the generators produce integers, via the nextInt method, instead of real numbers.
RandomVariateGenInt | ( | RandomStream | s, |
DiscreteDistributionInt | dist | ||
) |
Creates a new random variate generator for the discrete distribution dist
, using stream s
.
s | random stream used for generating uniforms |
dist | discrete distribution object of the generated values |
DiscreteDistributionInt getDistribution | ( | ) |
Returns the umontreal.ssj.probdist.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.
The results are stored into the array v
, starting from index start
. By default, this method calls nextInt() n
times, but one can reimplement it in subclasses for better efficiency.
v | array into which the variates will be stored |
start | starting index, in v , of the new variates |
n | number of variates being generated |
int [] nextArrayOfInt | ( | int | n | ) |
Generates n
random numbers from the discrete distribution contained in this object, and returns them in a new array of size n
.
By default, this method calls nextInt() n
times, but one can override it in subclasses for better efficiency.
n | number of variates to generate |
int nextInt | ( | ) |
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.