Class KISSRandom
java.lang.Object
org.apache.commons.rng.core.BaseProvider
org.apache.commons.rng.core.source32.IntProvider
org.apache.commons.rng.core.source32.KISSRandom
- All Implemented Interfaces:
RandomIntSource, RestorableUniformRandomProvider, UniformRandomProvider
Port from Marsaglia's
"KISS" algorithm.
This version contains the correction referred to
here
in a reply to the original post.
- Since:
- 1.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]Creates a snapshot of the RNG state.intnext()Return the next random value.protected voidsetStateInternal(byte[] s) Resets the RNG to the givenstate.Methods inherited from class IntProvider
nextBoolean, nextBytes, nextBytes, nextDouble, nextInt, nextLong, resetCachedStateMethods inherited from class BaseProvider
checkIndex, checkStateSize, composeStateInternal, extendSeed, extendSeed, fillState, fillState, restoreState, saveState, splitStateInternal, toString
-
Constructor Details
-
KISSRandom
Creates a new instance.- Parameters:
seed- Seed. If the length is larger than 4, only the first 4 elements will be used; if smaller, the remaining elements will be automatically set.
-
-
Method Details
-
getStateInternal
Creates a snapshot of the RNG state.- Overrides:
getStateInternalin classIntProvider- Returns:
- the internal state.
-
setStateInternal
Resets the RNG to the givenstate.- Overrides:
setStateInternalin classIntProvider- Parameters:
s- State (previously obtained by a call toBaseProvider.getStateInternal()).- See Also:
-
next
-