SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.randvar.RandomVariateGenInt Class Reference

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

Inheritance diagram for umontreal.ssj.randvar.RandomVariateGenInt:
umontreal.ssj.randvar.RandomVariateGen umontreal.ssj.randvar.BernoulliGen umontreal.ssj.randvar.BinomialGen umontreal.ssj.randvar.GeometricGen umontreal.ssj.randvar.HypergeometricGen umontreal.ssj.randvar.LogarithmicGen umontreal.ssj.randvar.NegativeBinomialGen umontreal.ssj.randvar.PascalGen umontreal.ssj.randvar.PoissonGen umontreal.ssj.randvar.UniformIntGen

Public Member Functions

 RandomVariateGenInt (RandomStream s, DiscreteDistributionInt dist)
 Creates a new random variate generator for the discrete distribution dist, using stream s.
int nextInt ()
 Generates a random number (an integer) from the discrete distribution contained in this object.
void nextArrayOfInt (int[] v, int start, int n)
 Generates n random numbers from the discrete distribution contained in this object.
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.
DiscreteDistributionInt getDistribution ()
 Returns the umontreal.ssj.probdist.DiscreteDistributionInt used by this generator.
Public Member Functions inherited from umontreal.ssj.randvar.RandomVariateGen
 RandomVariateGen (RandomStream s, Distribution dist)
 Creates a new random variate generator from the distribution dist, using stream s.
double nextDouble ()
 Generates a random number from the continuous distribution contained in this object.
void nextArrayOfDouble (double[] v, int start, int n)
 Generates n random numbers from the continuous distribution contained in this object.
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.
RandomStream getStream ()
 Returns the umontreal.ssj.rng.RandomStream used by this generator.
void setStream (RandomStream stream)
 Sets the umontreal.ssj.rng.RandomStream used by this generator to stream.
String toString ()
 Returns a String containing information about the current generator.

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.

Definition at line 41 of file RandomVariateGenInt.java.

Constructor & Destructor Documentation

◆ RandomVariateGenInt()

umontreal.ssj.randvar.RandomVariateGenInt.RandomVariateGenInt ( RandomStream s,
DiscreteDistributionInt dist )

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

Definition at line 53 of file RandomVariateGenInt.java.

Member Function Documentation

◆ getDistribution()

DiscreteDistributionInt umontreal.ssj.randvar.RandomVariateGenInt.getDistribution ( )

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

Returns
the distribution associated to that object

Reimplemented from umontreal.ssj.randvar.RandomVariateGen.

Definition at line 111 of file RandomVariateGenInt.java.

◆ nextArrayOfInt() [1/2]

int[] umontreal.ssj.randvar.RandomVariateGenInt.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

Definition at line 96 of file RandomVariateGenInt.java.

◆ nextArrayOfInt() [2/2]

void umontreal.ssj.randvar.RandomVariateGenInt.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

Definition at line 80 of file RandomVariateGenInt.java.

◆ nextInt()

int umontreal.ssj.randvar.RandomVariateGenInt.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

Reimplemented in umontreal.ssj.randvar.BinomialConvolutionGen, umontreal.ssj.randvar.GeometricGen, umontreal.ssj.randvar.LogarithmicGen, umontreal.ssj.randvar.PascalConvolutionGen, and umontreal.ssj.randvar.PoissonTIACGen.

Definition at line 66 of file RandomVariateGenInt.java.


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