public abstract class LongProvider extends BaseProvider implements RandomLongSource
long
-based
source randomness.Modifier | Constructor and Description |
---|---|
|
LongProvider()
Creates a new instance.
|
protected |
LongProvider(LongProvider source)
Creates a new instance copying the state from the source.
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
getStateInternal()
Creates a snapshot of the RNG state.
|
boolean |
nextBoolean() |
int |
nextInt() |
long |
nextLong() |
protected void |
resetCachedState()
Reset the cached state used in the default implementation of
nextBoolean()
and nextInt() . |
protected void |
setStateInternal(byte[] s)
Resets the RNG to the given
state . |
checkIndex, checkStateSize, composeStateInternal, extendSeed, extendSeed, fillState, fillState, restoreState, saveState, splitStateInternal, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
next
public LongProvider()
protected LongProvider(LongProvider source)
This provides base functionality to allow a generator to create a copy, for example
for use in the JumpableUniformRandomProvider
interface.
source
- Source to copy.protected void resetCachedState()
nextBoolean()
and nextInt()
.
This should be used when the state is no longer valid, for example after a jump
performed for the JumpableUniformRandomProvider
interface.
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)
public long nextLong()
nextLong
in interface UniformRandomProvider
public int nextInt()
nextInt
in interface UniformRandomProvider
public boolean nextBoolean()
nextBoolean
in interface UniformRandomProvider
Copyright © 2016–2022 The Apache Software Foundation. All rights reserved.