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

This class implements a random variate generator for the uniform distribution over integers, over the interval \([i,j]\). More...

Inheritance diagram for umontreal.ssj.randvar.UniformIntGen:
umontreal.ssj.randvar.RandomVariateGenInt umontreal.ssj.randvar.RandomVariateGen

Public Member Functions

 UniformIntGen (RandomStream s, int i, int j)
 Creates a uniform random variate generator over the integers in the closed interval \([i, j]\), using stream s.
 UniformIntGen (RandomStream s, UniformIntDist dist)
 Creates a new generator for the distribution dist, using stream s.
int getI ()
 Returns the parameter \(i\).
int getJ ()
 Returns the parameter \(j\).
Public Member Functions inherited from umontreal.ssj.randvar.RandomVariateGenInt
 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.

Static Public Member Functions

static int nextInt (RandomStream s, int i, int j)
 Generates a new uniform random variate over the interval.

Detailed Description

This class implements a random variate generator for the uniform distribution over integers, over the interval \([i,j]\).

Its mass function is

\[ p(x) = \frac{1}{j - i + 1} \qquad\mbox{ for } x = i, i + 1, …, j \tag{fmassuniformint} \]

and 0 elsewhere.

Definition at line 43 of file UniformIntGen.java.

Constructor & Destructor Documentation

◆ UniformIntGen() [1/2]

umontreal.ssj.randvar.UniformIntGen.UniformIntGen ( RandomStream s,
int i,
int j )

Creates a uniform random variate generator over the integers in the closed interval \([i, j]\), using stream s.

Definition at line 51 of file UniformIntGen.java.

◆ UniformIntGen() [2/2]

umontreal.ssj.randvar.UniformIntGen.UniformIntGen ( RandomStream s,
UniformIntDist dist )

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

Definition at line 59 of file UniformIntGen.java.

Member Function Documentation

◆ getI()

int umontreal.ssj.randvar.UniformIntGen.getI ( )

Returns the parameter \(i\).

Definition at line 77 of file UniformIntGen.java.

◆ getJ()

int umontreal.ssj.randvar.UniformIntGen.getJ ( )

Returns the parameter \(j\).

Definition at line 84 of file UniformIntGen.java.

◆ nextInt()

int umontreal.ssj.randvar.UniformIntGen.nextInt ( RandomStream s,
int i,
int j )
static

Generates a new uniform random variate over the interval.

\([i,j]\), using stream s, by inversion.

Definition at line 70 of file UniformIntGen.java.


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