Class TwoCmres
java.lang.Object
org.apache.commons.rng.core.BaseProvider
org.apache.commons.rng.core.source64.LongProvider
org.apache.commons.rng.core.source64.TwoCmres
- All Implemented Interfaces:
RandomLongSource, RestorableUniformRandomProvider, UniformRandomProvider
Random number generator designed by Mark D. Overton.
It is one of the many generators described by the author in the following article series:
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]Creates a snapshot of the RNG state.longnext()Return the next random value.static intGet the number of subcycle generators.protected voidsetStateInternal(byte[] s) Resets the RNG to the givenstate.toString()Methods inherited from class LongProvider
nextBoolean, nextInt, nextLong, resetCachedStateMethods inherited from class BaseProvider
checkIndex, checkStateSize, composeStateInternal, extendSeed, extendSeed, fillState, fillState, restoreState, saveState, splitStateInternal
-
Constructor Details
-
TwoCmres
-
TwoCmres
Creates a new instance.- Parameters:
seed- Seed.i- Table entry for first subcycle generator.j- Table entry for second subcycle generator.- Throws:
IllegalArgumentException- ifi == j.IndexOutOfBoundsException- ifi < 0ori >= numberOfSubcycleGenerators().IndexOutOfBoundsException- ifj < 0orj >= numberOfSubcycleGenerators().
-
-
Method Details
-
next
-
toString
- Overrides:
toStringin classBaseProvider
-
numberOfSubcycleGenerators
Get the number of subcycle generators.- Returns:
- the number of subcycle generators.
-
getStateInternal
Creates a snapshot of the RNG state.- Overrides:
getStateInternalin classLongProvider- Returns:
- the internal state.
-
setStateInternal
Resets the RNG to the givenstate.- Overrides:
setStateInternalin classLongProvider- Parameters:
s- State (previously obtained by a call toBaseProvider.getStateInternal()).- See Also:
-