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

This container class allows the user to force any RandomStream to return antithetic variates. More...

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

Public Member Functions

 AntitheticStream (RandomStream stream)
 Constructs a new antithetic stream, using the random numbers from the base stream stream.
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:
String toString ()
 Returns a string starting with "Antithetic of " and finishing with the result of the call to the toString method of the generator.
double nextDouble ()
 Returns 1.0 - s.nextDouble() where s is the base stream.
int nextInt (int i, int j)
 Returns j - i - s.nextInt(i, j) where s is the base stream.
void nextArrayOfDouble (double[] u, int start, int n)
 Calls nextArrayOfDouble (u, start, n) for the base stream, then replaces each u[i] by 1.0 - u[i].
void nextArrayOfInt (int i, int j, int[] u, int start, int n)
 Calls nextArrayOfInt (i, j, u, start, n) for the base stream, then replaces each u[i] by j - i - u[i].

Detailed Description

This container class allows the user to force any RandomStream to return antithetic variates.

That is, nextDouble returns \(1-u\) instead of \(u\) and the corresponding change is made in nextInt. Any instance of this class behaves exactly like a RandomStream, except that it depends on another random number generator stream, called the base stream, to generate its numbers. Any call to one of the next... methods of this class will modify the state of the base stream.

Definition at line 39 of file AntitheticStream.java.

Constructor & Destructor Documentation

◆ AntitheticStream()

umontreal.ssj.rng.AntitheticStream.AntitheticStream ( RandomStream stream)

Constructs a new antithetic stream, using the random numbers from the base stream stream.

Definition at line 48 of file AntitheticStream.java.

Member Function Documentation

◆ nextArrayOfDouble()

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

Calls nextArrayOfDouble (u, start, n) for the base stream, then replaces each u[i] by 1.0 - u[i].

Parameters
uthe array in which the numbers will be stored
startthe first index of u to be used
nthe number of random numbers to put in u

Implements umontreal.ssj.rng.RandomStream.

Definition at line 95 of file AntitheticStream.java.

◆ nextArrayOfInt()

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

Calls nextArrayOfInt (i, j, u, start, n) for the base stream, then replaces each u[i] by j - i - u[i].

Parameters
ithe smallest possible integer to put in u
jthe largest possible integer to put in u
uthe array in which the numbers will be stored
startthe first index of u to be used
nthe number of random numbers to put in u

Implements umontreal.ssj.rng.RandomStream.

Definition at line 111 of file AntitheticStream.java.

◆ nextDouble()

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

Returns 1.0 - s.nextDouble() where s is the base stream.

Implements umontreal.ssj.rng.RandomStream.

Definition at line 75 of file AntitheticStream.java.

◆ nextInt()

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

Returns j - i - s.nextInt(i, j) where s is the base stream.

Implements umontreal.ssj.rng.RandomStream.

Definition at line 82 of file AntitheticStream.java.

◆ resetNextSubstream()

void umontreal.ssj.rng.AntitheticStream.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 60 of file AntitheticStream.java.

◆ resetStartStream()

void umontreal.ssj.rng.AntitheticStream.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 52 of file AntitheticStream.java.

◆ resetStartSubstream()

void umontreal.ssj.rng.AntitheticStream.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 56 of file AntitheticStream.java.

◆ toString()

String umontreal.ssj.rng.AntitheticStream.toString ( )

Returns a string starting with "Antithetic of " and finishing with the result of the call to the toString method of the generator.

Implements umontreal.ssj.rng.RandomStream.

Definition at line 68 of file AntitheticStream.java.


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