public class BakerTransformedStream extends java.lang.Object implements RandomStream
RandomStream.
It transforms each
u∈[0, 1] into 2u if u <= 1/2 and 2(1 - u)
if u > 1/2.
The nextDouble method will return the result of this transformation
and the other next... methods are affected accordingly.
Any instance of this class contains a RandomStream called its
base stream, used to generate its numbers and to which the
transformation is applied.
Any call to one of the next...
methods of this class will modify the state of the base stream.
The baker transformation is often applied when the RandomStream
is actually an iterator over a point set used for quasi-Monte Carlo
integration (see the hups package).
| Constructor and Description |
|---|
BakerTransformedStream(RandomStream stream)
Constructs a new baker transformed stream, using the random
numbers from the base stream stream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
nextArrayOfDouble(double[] u,
int start,
int n)
Calls nextArrayOfDouble (u, start, n) for the base stream,
then applies the baker transformation.
|
void |
nextArrayOfInt(int i,
int j,
int[] u,
int start,
int n)
Fills up the array by calling nextInt (i, j).
|
double |
nextDouble()
Returns the baker transformation of s.nextDouble()
where s is the base stream.
|
int |
nextInt(int i,
int j)
Generates a random integer in
{i,..., j} via
nextDouble (in which the baker transformation is applied). |
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.
|
java.lang.String |
toString()
Returns a string starting with "Baker transformation of "
and finishing with the result of the call to the toString
method of the generator.
|
public BakerTransformedStream(RandomStream stream)
public void resetStartStream()
RandomStreamresetStartStream in interface RandomStreampublic void resetStartSubstream()
RandomStreamresetStartSubstream in interface RandomStreampublic void resetNextSubstream()
RandomStreamresetNextSubstream in interface RandomStreampublic java.lang.String toString()
toString in interface RandomStreamtoString in class java.lang.Objectpublic double nextDouble()
nextDouble in interface RandomStreampublic int nextInt(int i,
int j)
nextDouble (in which the baker transformation is applied).nextInt in interface RandomStreami - smallest integer that can be generatedj - greatest integer that can be generatedpublic void nextArrayOfDouble(double[] u,
int start,
int n)
nextArrayOfDouble in interface RandomStreamu - 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 RandomStreami - 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 uTo submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.