SSJ  3.2.1 Stochastic Simulation in Java
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...

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...

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.

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 ( RandomStream s, DiscreteDistributionInt dist )

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

Parameters
 s random stream used for generating uniforms dist discrete distribution object of the generated values

## Member Function Documentation

 DiscreteDistributionInt getDistribution ( )

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

Returns
the distribution associated to that object
 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
 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 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:
• RandomVariateGenInt.java