RandomIntSource
, RestorableUniformRandomProvider
, UniformRandomProvider
public class JDKRandom extends IntProvider
Random.nextInt()
method of the JDK's
Random
class as the source of randomness.
Caveat: All the other calls will be redirected to the methods implemented within this library.
The state of this source of randomness is saved and restored through
the serialization of the Random
instance.
Constructor | Description |
---|---|
JDKRandom(java.lang.Long seed) |
Creates an instance with the given seed.
|
Modifier and Type | Method | Description |
---|---|---|
protected byte[] |
getStateInternal() |
Creates a snapshot of the RNG state.
|
int |
next() |
|
protected void |
setStateInternal(byte[] s) |
Resets the RNG to the given
state . |
checkIndex, checkStateSize, fillState, fillState, nextInt, nextLong, restoreState, saveState, toString
nextBoolean, nextBytes, nextBytes, nextDouble, nextFloat, nextInt, nextLong
public JDKRandom(java.lang.Long seed)
seed
- Initial seed.public int next()
Random.nextInt()
protected byte[] getStateInternal()
getStateInternal
in class BaseProvider
protected void setStateInternal(byte[] s)
state
.setStateInternal
in class BaseProvider
s
- State (previously obtained by a call to
BaseProvider.getStateInternal()
).BaseProvider.checkStateSize(byte[],int)
Copyright © 2016–2018 The Apache Software Foundation. All rights reserved.