public class StatefulRNG extends RNG
RNG.CustomRandom
DOUBLE_UNIT, FLOAT_UNIT, haveNextNextGaussian, nextNextGaussian, ran, random
Constructor and Description |
---|
StatefulRNG() |
StatefulRNG(long seed)
Seeded constructor uses LightRNG, which is of high quality, but low period (which rarely matters for games),
and has good speed and tiny state size.
|
StatefulRNG(RandomnessSource random) |
StatefulRNG(String seedString)
String-seeded constructor uses the hash of the String as a seed for LightRNG, which is of high quality, but low
period (which rarely matters for games), and has good speed and tiny state size.
|
Modifier and Type | Method and Description |
---|---|
RNG |
copy()
Creates a copy of this StatefulRNG; it will generate the same random numbers, given the same calls in order, as
this StatefulRNG at the point copy() is called.
|
long |
getState()
Get a long that can be used to reproduce the sequence of random numbers this object will generate starting now.
|
void |
setRandomness(RandomnessSource random) |
void |
setState(long state)
Sets the state of the random number generator to a given long, which will alter future random numbers this
produces based on the state.
|
String |
toString() |
asRandom, between, between, between, betweenWeighted, getRandomElement, getRandomElement, getRandomElement, getRandomElement, getRandomness, getRandomStartIterable, next, nextBoolean, nextDouble, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong, nextLong, randomPortion, randomPortion, randomRange, randomRotation, shuffle, shuffle, shuffle
public StatefulRNG()
public StatefulRNG(RandomnessSource random)
public StatefulRNG(long seed)
public StatefulRNG(String seedString)
public void setRandomness(RandomnessSource random)
setRandomness
in class RNG
public RNG copy()
public long getState()
public void setState(long state)
state
- a long, which typically should not be 0 (some implementations may tolerate a state of 0, however).Copyright © 2012–2016. All rights reserved.