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

Represents a container random stream generating numbers in an interval. More...

Inheritance diagram for umontreal.ssj.rng.TruncatedRandomStream:
umontreal.ssj.rng.RandomStream

Public Member Functions

void resetStartStream ()
 Reinitializes the stream to its initial state \(I_g\): \(C_g\) and \(B_g\) are set to \(I_g\).
void resetStartSubstream ()
 Reinitializes the stream to the beginning of its current substream:
void resetNextSubstream ()
 Reinitializes the stream to the beginning of its next substream:
double nextDouble ()
 Returns a (pseudo)random number from the uniform distribution over the interval \((0,1)\), using this stream, after advancing its state by one step.
void nextArrayOfDouble (double[] u, int start, int n)
 Generates n (pseudo)random numbers from the uniform distribution and stores them into the array u starting at index start.
int nextInt (int i, int j)
 Returns a (pseudo)random number from the discrete uniform distribution over the integers \(\{i,i+1,…,j\}\), using this stream.
void nextArrayOfInt (int i, int j, int[] u, int start, int n)
 Generates n (pseudo)random numbers from the discrete uniform distribution over the integers \(\{i,i+1,…,j\}\), using this stream and stores the result in the array u starting at index start.
Public Member Functions inherited from umontreal.ssj.rng.RandomStream
String toString ()
 Returns a string containing the current state of this stream.

Detailed Description

Represents a container random stream generating numbers in an interval.

\((a,b)\) instead of in \((0,1)\), where \(0\le a < b \le1\), by using the contained stream. If nextDouble returns \(u\) for the contained stream, it will return \(v = a + (b-a)u\), which is uniform over \((a,b)\), for the truncated stream. The method nextInt returns the integer that corresponds to \(v\) (by inversion); this integer is no longer uniformly distributed in general.

Definition at line 43 of file TruncatedRandomStream.java.

Member Function Documentation

◆ nextArrayOfDouble()

void umontreal.ssj.rng.TruncatedRandomStream.nextArrayOfDouble ( double[] u,
int start,
int n )

Generates n (pseudo)random numbers from the uniform distribution and stores them into the array u starting at index start.

Parameters
uarray that will contain the generated uniforms
startstarting index, in the array u, to write uniforms from
nnumber of uniforms to generate

Implements umontreal.ssj.rng.RandomStream.

Definition at line 77 of file TruncatedRandomStream.java.

◆ nextArrayOfInt()

void umontreal.ssj.rng.TruncatedRandomStream.nextArrayOfInt ( int i,
int j,
int[] u,
int start,
int n )

Generates n (pseudo)random numbers from the discrete uniform distribution over the integers \(\{i,i+1,…,j\}\), using this stream and stores the result in the array u starting at index start.

(Calls nextInt n times.)

Parameters
ismallest integer that can be generated
jgreatest integer that can be generated
uarray that will contain the generated values
startstarting index, in the array u, to write integers from
nnumber of values being generated

Implements umontreal.ssj.rng.RandomStream.

Definition at line 87 of file TruncatedRandomStream.java.

◆ nextDouble()

double umontreal.ssj.rng.TruncatedRandomStream.nextDouble ( )

Returns a (pseudo)random number from the uniform distribution over the interval \((0,1)\), using this stream, after advancing its state by one step.

The generators programmed in SSJ never return the values 0 or 1.

Returns
the next generated uniform

Implements umontreal.ssj.rng.RandomStream.

Definition at line 72 of file TruncatedRandomStream.java.

◆ nextInt()

int umontreal.ssj.rng.TruncatedRandomStream.nextInt ( int i,
int j )

Returns a (pseudo)random number from the discrete uniform distribution over the integers \(\{i,i+1,…,j\}\), using this stream.

(Calls nextDouble once.)

Parameters
ismallest integer that can be generated
jgreatest integer that can be generated
Returns
the generated integer

Implements umontreal.ssj.rng.RandomStream.

Definition at line 83 of file TruncatedRandomStream.java.

◆ resetNextSubstream()

void umontreal.ssj.rng.TruncatedRandomStream.resetNextSubstream ( )

Reinitializes the stream to the beginning of its next substream:

\(N_g\) is computed, and \(C_g\) and \(B_g\) are set to \(N_g\).

Implements umontreal.ssj.rng.RandomStream.

Definition at line 68 of file TruncatedRandomStream.java.

◆ resetStartStream()

void umontreal.ssj.rng.TruncatedRandomStream.resetStartStream ( )

Reinitializes the stream to its initial state \(I_g\): \(C_g\) and \(B_g\) are set to \(I_g\).

Implements umontreal.ssj.rng.RandomStream.

Definition at line 60 of file TruncatedRandomStream.java.

◆ resetStartSubstream()

void umontreal.ssj.rng.TruncatedRandomStream.resetStartSubstream ( )

Reinitializes the stream to the beginning of its current substream:

\(C_g\) is set to \(B_g\).

Implements umontreal.ssj.rng.RandomStream.

Definition at line 64 of file TruncatedRandomStream.java.


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