25package umontreal.ssj.rng;
27import java.io.Serializable;
56 private static final long serialVersionUID = 70510L;
60 protected static double invtwo24 = 5.9604644775390625e-8;
61 private static double EPSILON = 5.5511151231257827e-17;
63 protected String name =
null;
66 protected boolean prec53 =
false;
67 protected boolean anti =
false;
120 u = (u +
nextValue() * invtwo24) % 1.0 + EPSILON;
136 throw new NullPointerException(
"The array must be initialized.");
137 if (u.length < n + start)
138 throw new IndexOutOfBoundsException(
"The array is too small.");
140 throw new IndexOutOfBoundsException(
"Must start at a " +
"non-negative index.");
142 throw new IllegalArgumentException(
"Must have a non-negative " +
"number of elements.");
144 for (
int ii = start; ii < start + n; ii++)
159 throw new IllegalArgumentException(i +
" is larger than " + j +
".");
162 return i + (int) (
nextDouble() * (j - i + 1.0));
177 throw new NullPointerException(
"The array must be " +
"initialized.");
178 if (u.length < n + start)
179 throw new IndexOutOfBoundsException(
"The array is too small.");
181 throw new IndexOutOfBoundsException(
"Must start at a " +
"non-negative index.");
183 throw new IllegalArgumentException(
"Must have a non-negative " +
"number of elements.");
185 for (
int ii = start; ii < start + n; ii++)
202 throw new UnsupportedOperationException(
" call the toStringFull() method instead.");
214 }
catch (CloneNotSupportedException cnse) {
215 cnse.printStackTrace(System.err);
This class provides a convenient foundation on which RNGs can be built.
abstract String toString()
Returns a string containing the current state of this stream.
String formatStateFull()
Use the toStringFull method.
abstract void resetStartSubstream()
Reinitializes the stream to the beginning of its current substream:
double nextDouble()
Returns a uniform random number between 0 and 1 from the stream.
int nextInt(int i, int j)
Calls nextDouble once to create one integer between i and j.
abstract double nextValue()
This method should return the next random number (between 0 and 1) from the current stream.
void nextArrayOfInt(int i, int j, int[] u, int start, int n)
Calls nextInt n times to fill the array u.
RandomStreamBase clone()
Clones the current generator and return its copy.
String formatState()
Use the toString method.
abstract void resetNextSubstream()
Reinitializes the stream to the beginning of its next substream:
void increasedPrecision(boolean incp)
After calling this method with incp = true, each call to the RNG (direct or indirect) for this stream...
void nextArrayOfDouble(double[] u, int start, int n)
Calls nextDouble n times to fill the array u.
abstract void resetStartStream()
Reinitializes the stream to its initial state : and are set to .
CloneableRandomStream extends RandomStream and Cloneable.