|
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.TruncatedRandomStream
public class TruncatedRandomStream
Represents a container random stream generating numbers in an interval (a, b) instead of in (0, 1), where 0 <= a < b <= 1, 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.
Constructor Summary | |
---|---|
TruncatedRandomStream(RandomStream stream,
double a,
double b)
|
Method Summary | |
---|---|
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. |
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. |
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. |
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 |
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface umontreal.iro.lecuyer.rng.RandomStream |
---|
toString |
Constructor Detail |
---|
public TruncatedRandomStream(RandomStream stream, double a, double b)
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 double nextDouble()
RandomStream
nextDouble
in interface RandomStream
public void nextArrayOfDouble(double[] u, int start, int n)
RandomStream
nextArrayOfDouble
in interface RandomStream
u
- array that will contain the generated uniformsstart
- starting index, in the array u, to write uniforms fromn
- number of uniforms to generatepublic int nextInt(int i, int j)
RandomStream
nextInt
in interface RandomStream
i
- smallest integer that can be generatedj
- greatest integer that can be generated
public void nextArrayOfInt(int i, int j, int[] u, int start, int n)
RandomStream
nextArrayOfInt
in interface RandomStream
i
- smallest integer that can be generatedj
- greatest integer that can be generatedu
- array that will contain the generated valuesstart
- starting index, in the array u, to write integers fromn
- number of values being generated
|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |