SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | List of all members
RandomVariateGenInt Class Reference

This is the base class for all generators of discrete random variates over the set of integers. More...

Inheritance diagram for RandomVariateGenInt:
[legend]
Collaboration diagram for RandomVariateGenInt:
[legend]

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ RandomVariateGenInt()

Creates a new random variate generator for the discrete distribution dist, using stream s.

Parameters
srandom stream used for generating uniforms
distdiscrete distribution object of the generated values

Member Function Documentation

◆ getDistribution()

DiscreteDistributionInt getDistribution ( )

Returns the umontreal.ssj.probdist.DiscreteDistributionInt used by this generator.

Returns
the distribution associated to that object

◆ nextArrayOfInt() [1/2]

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.

Parameters
varray into which the variates will be stored
startstarting index, in v, of the new variates
nnumber of variates being generated

◆ nextArrayOfInt() [2/2]

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.

Parameters
nnumber of variates to generate
Returns
a new array with the generated numbers

◆ nextInt()

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.

Returns
the generated value

The documentation for this class was generated from the following file: