public static final class LCG64ShiftRandom.ThreadSafe extends LCG64ShiftRandom
LCG64ShiftRandom.Param, LCG64ShiftRandom.ThreadLocal, LCG64ShiftRandom.ThreadSafe| Constructor and Description |
|---|
ThreadSafe()
Create a new PRNG instance with
LCG64ShiftRandom.Param.DEFAULT parameter and
a safe seed. |
ThreadSafe(LCG64ShiftRandom.Param param)
Create a new PRNG instance with the given parameter and a safe
default seed.
|
ThreadSafe(LCG64ShiftRandom.Param param,
long seed)
Create a new PRNG instance with the given parameter and seed.
|
ThreadSafe(long seed)
Create a new PRNG instance with
LCG64ShiftRandom.Param.DEFAULT parameter and
the given seed. |
ThreadSafe(long seed,
LCG64ShiftRandom.Param param)
Deprecated.
Use
LCG64ShiftRandom.ThreadSafe(Param, long)
instead. |
| 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 |
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, getParam, hashCode, toStringnext, nextBoolean, nextBytes, nextDouble, nextFloat, nextInt, of@Deprecated public ThreadSafe(long seed, LCG64ShiftRandom.Param param)
LCG64ShiftRandom.ThreadSafe(Param, long)
instead.seed - the seed of the PRNG.param - the parameter of the PRNG.NullPointerException - if the given param is null.public ThreadSafe(LCG64ShiftRandom.Param param, long seed)
seed - the seed of the PRNG.param - the parameter of the PRNG.NullPointerException - if the given param is null.public ThreadSafe(long seed)
LCG64ShiftRandom.Param.DEFAULT parameter and
the given seed.seed - the seed of the PRNGpublic ThreadSafe(LCG64ShiftRandom.Param param)
param - the PRNG parameter.NullPointerException - if the given param is null.public ThreadSafe()
LCG64ShiftRandom.Param.DEFAULT parameter and
a safe seed.public void setSeed(long seed)
setSeed 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 integer (inclusively)max - upper bound for generated integer (inclusively)min and less
than or equal to maxIllegalArgumentException - if min >= maxrandom.nextInt(java.util.Random, int, int)public long nextLong(long min, long max)
min - lower bound for generated long integer (inclusively)max - upper bound for generated long integer (inclusively)min
and less than or equal to maxIllegalArgumentException - if min >= maxrandom.nextLong(java.util.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.random.nextLong(java.util.Random, long)public float nextFloat(float min, float max)
min - lower bound for generated float value (inclusively)max - upper bound for generated float value (exclusively)min and less
than to maxrandom.nextFloat(java.util.Random, float, float)public double nextDouble(double min, double max)
min - lower bound for generated double value (inclusively)max - upper bound for generated double value (exclusively)min and less
than to maxrandom.nextDouble(java.util.Random, double, double)© 2007-2017 Franz Wilhelmstötter (2017-04-28 16:50)