public abstract class IntProvider extends BaseProvider implements RandomIntSource
int-based
source randomness.| Modifier | Constructor and Description |
|---|---|
|
IntProvider()
Creates a new instance.
|
protected |
IntProvider(IntProvider 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() |
void |
nextBytes(byte[] bytes) |
void |
nextBytes(byte[] bytes,
int start,
int len) |
double |
nextDouble() |
int |
nextInt() |
long |
nextLong() |
protected void |
resetCachedState()
Reset the cached state used in the default implementation of
nextBoolean(). |
protected void |
setStateInternal(byte[] s)
Resets the RNG to the given
state. |
checkIndex, checkStateSize, composeStateInternal, extendSeed, extendSeed, fillState, fillState, restoreState, saveState, splitStateInternal, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitnextpublic IntProvider()
protected IntProvider(IntProvider 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().
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 BaseProviderprotected void setStateInternal(byte[] s)
state.setStateInternal in class BaseProviders - State (previously obtained by a call to
BaseProvider.getStateInternal()).BaseProvider.checkStateSize(byte[],int)public int nextInt()
nextInt in interface UniformRandomProviderpublic boolean nextBoolean()
nextBoolean in interface UniformRandomProviderpublic double nextDouble()
nextDouble in interface UniformRandomProviderpublic long nextLong()
nextLong in interface UniformRandomProviderpublic void nextBytes(byte[] bytes)
nextBytes in interface UniformRandomProviderpublic void nextBytes(byte[] bytes, int start, int len)
nextBytes in interface UniformRandomProviderCopyright © 2016–2022 The Apache Software Foundation. All rights reserved.