public static class LCG64ShiftRandom.ThreadSafe extends LCG64ShiftRandom
LCG64ShiftRandom.Param, LCG64ShiftRandom.ThreadLocal, LCG64ShiftRandom.ThreadSafe| Constructor and Description |
|---|
LCG64ShiftRandom.ThreadSafe()
Create a new PRNG instance with
LCG64ShiftRandom.Param.DEFAULT parameter and
a safe seed. |
LCG64ShiftRandom.ThreadSafe(LCG64ShiftRandom.Param param)
Create a new PRNG instance with the given parameter and a safe
default seed.
|
LCG64ShiftRandom.ThreadSafe(long seed)
Create a new PRNG instance with
LCG64ShiftRandom.Param.DEFAULT parameter and
the given seed. |
LCG64ShiftRandom.ThreadSafe(long seed,
LCG64ShiftRandom.Param param)
Create a new PRNG instance with the given parameter and seed.
|
| Modifier and Type | Method and Description |
|---|---|
void |
jump(long step)
Changes the internal state of the PRNG in such a way that the engine
jumps s steps ahead.
|
void |
jump2(int s)
Changes the internal state of the PRNG in such a way that the engine
jumps 2s steps ahead.
|
double |
nextDouble(double min,
double max)
Returns a pseudorandom, uniformly distributed double value between
min (inclusively) and max (exclusively).
|
float |
nextFloat(float min,
float max)
Returns a pseudorandom, uniformly distributed double value between
min (inclusively) and max (exclusively).
|
int |
nextInt(int min,
int max)
Returns a pseudorandom, uniformly distributed int value between min and
max (end points included).
|
long |
nextLong()
Force to explicitly override the Random.nextLong() method.
|
long |
nextLong(long n)
Returns a pseudorandom, uniformly distributed int value between 0
(inclusive) and the specified value (exclusive), drawn from the given
random number generator's sequence.
|
long |
nextLong(long min,
long max)
Returns a pseudorandom, uniformly distributed int value between min
and max (end points included).
|
void |
reset()
Resets the PRNG back to the creation state.
|
void |
setSeed(long seed) |
void |
split(int p,
int s)
Changes the internal state of the PRNG in a way that future calls to
LCG64ShiftRandom.nextLong() will generated the sth sub-stream of
pth sub-streams. |
equals, hashCode, toStringnext, nextBoolean, nextBytes, nextDouble, nextFloat, nextIntnextGaussian, nextIntpublic LCG64ShiftRandom.ThreadSafe(long seed, LCG64ShiftRandom.Param param)
seed - the seed of the PRNG.param - the parameter of the PRNG.NullPointerException - if the given param is null.public LCG64ShiftRandom.ThreadSafe(long seed)
LCG64ShiftRandom.Param.DEFAULT parameter and
the given seed.seed - the seed of the PRNGpublic LCG64ShiftRandom.ThreadSafe(LCG64ShiftRandom.Param param)
param - the PRNG parameter.NullPointerException - if the given param is null.public LCG64ShiftRandom.ThreadSafe()
LCG64ShiftRandom.Param.DEFAULT parameter and
a safe seed.public void setSeed(long seed)
setSeed in class LCG64ShiftRandompublic void reset()
LCG64ShiftRandomreset in class LCG64ShiftRandompublic long nextLong()
Random64nextLong in class LCG64ShiftRandompublic void split(int p, int s)
LCG64ShiftRandomLCG64ShiftRandom.nextLong() will generated the sth sub-stream of
pth sub-streams. s must be within the range of
[0, p-1). This method is mainly used for parallelization
via leap-frogging.split in class LCG64ShiftRandomp - the overall number of sub-streamss - the sth sub-streampublic void jump2(int s)
LCG64ShiftRandomjump2 in class LCG64ShiftRandoms - the 2s steps to jump ahead.public void jump(long step)
LCG64ShiftRandomjump in class LCG64ShiftRandomstep - the steps to jump ahead.public int nextInt(int min, int max)
min - lower bound for generated integermax - upper bound for generated integermin and less
than or equal to maxIllegalArgumentException - if min >= maxmath.random.nextInt(Random, int, int)public long nextLong(long min, long max)
min - lower bound for generated long integermax - upper bound for generated long integermin
and less than or equal to maxIllegalArgumentException - if min >= maxmath.random.nextLong(Random, long, long)public long nextLong(long n)
n - the bound on the random number to be returned. Must be
positive.IllegalArgumentException - if n is smaller than 1.math.random.nextLong(Random, long)public float nextFloat(float min, float max)
min - lower bound for generated float valuemax - upper bound for generated float valuemin and less
than to maxmath.random.nextFloat(Random, float, float)public double nextDouble(double min, double max)
min - lower bound for generated double valuemax - upper bound for generated double valuemin and less
than to maxmath.random.nextDouble(Random, double, double)© 2007-2013 Franz Wilhelmstötter (2013-12-18 20:17)