public abstract class BaseProvider extends Object implements RestorableUniformRandomProvider
| Constructor and Description |
|---|
BaseProvider() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkIndex(int min,
int max,
int index)
Checks whether
index is in the range [min, max]. |
protected void |
checkStateSize(byte[] state,
int expected)
Checks that the
state has the expected size. |
protected void |
fillState(int[] state,
int[] seed)
Simple filling procedure.
|
protected void |
fillState(long[] state,
long[] seed)
Simple filling procedure.
|
protected byte[] |
getStateInternal()
Creates a snapshot of the RNG state.
|
int |
nextInt(int n) |
long |
nextLong(long n) |
void |
restoreState(RandomProviderState state) |
RandomProviderState |
saveState() |
protected void |
setStateInternal(byte[] state)
Resets the RNG to the given
state. |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitnextBoolean, nextBytes, nextBytes, nextDouble, nextFloat, nextInt, nextLongpublic int nextInt(int n)
nextInt in interface UniformRandomProviderpublic long nextLong(long n)
nextLong in interface UniformRandomProviderpublic RandomProviderState saveState()
saveState in interface RestorableUniformRandomProviderpublic void restoreState(RandomProviderState state)
restoreState in interface RestorableUniformRandomProviderprotected byte[] getStateInternal()
UnsupportedOperationException - if not implemented.protected void setStateInternal(byte[] state)
state.state - State (previously obtained by a call to
getStateInternal()).UnsupportedOperationException - if not implemented.checkStateSize(byte[],int)protected void fillState(int[] state,
int[] seed)
state by copying
min(seed.length, state.length) elements from
seed,
state with non-zero
values (even if seed.length < state.length).
state - State. Must be allocated.seed - Seed. Cannot be null.protected void fillState(long[] state,
long[] seed)
state by copying
min(seed.length, state.length) elements from
seed,
state with non-zero
values (even if seed.length < state.length).
state - State. Must be allocated.seed - Seed. Cannot be null.protected void checkStateSize(byte[] state,
int expected)
state has the expected size.state - State.expected - Expected length of state array.IllegalArgumentException - if state.length != expected.protected void checkIndex(int min,
int max,
int index)
index is in the range [min, max].min - Lower bound.max - Upper bound.index - Value that must lie within the [min, max] interval.IndexOutOfBoundsException - if index is not within the
[min, max] interval.Copyright © 2016 The Apache Software Foundation. All rights reserved.