|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object umontreal.iro.lecuyer.rng.AntitheticStream
public class AntitheticStream
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.
Constructor Summary | |
---|---|
AntitheticStream(RandomStream stream)
Constructs a new antithetic stream, using the random numbers from the base stream stream. |
Method Summary | |
---|---|
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]. |
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 |
resetNextSubstream()
Reinitializes the stream to the beginning of its next substream: Ng is computed, and Cg and Bg are set to Ng. |
void |
resetStartStream()
Reinitializes the stream to its initial state Ig: Cg and Bg are set to Ig. |
void |
resetStartSubstream()
Reinitializes the stream to the beginning of its current substream: Cg is set to Bg. |
String |
toString()
Returns a string starting with "Antithetic of " and finishing with the result of the call to the toString method of the generator. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AntitheticStream(RandomStream stream)
Method Detail |
---|
public void resetStartStream()
RandomStream
resetStartStream
in interface RandomStream
public void resetStartSubstream()
RandomStream
resetStartSubstream
in interface RandomStream
public void resetNextSubstream()
RandomStream
resetNextSubstream
in interface RandomStream
public String toString()
toString
in interface RandomStream
toString
in class Object
public double nextDouble()
nextDouble
in interface RandomStream
public int nextInt(int i, int j)
nextInt
in interface RandomStream
i
- smallest integer that can be generatedj
- greatest integer that can be generated
public void nextArrayOfDouble(double[] u, int start, int n)
nextArrayOfDouble
in interface RandomStream
u
- the array in which the numbers will be storedstart
- the first index of u to be usedn
- the number of random numbers to put in upublic void nextArrayOfInt(int i, int j, int[] u, int start, int n)
nextArrayOfInt
in interface RandomStream
i
- the smallest possible integer to put in uj
- the largest possible integer to put in uu
- the array in which the numbers will be storedstart
- the first index of u to be usedn
- the number of random numbers to put in u
|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |