Class SplitMix64
- java.lang.Object
-
- org.apache.commons.rng.core.BaseProvider
-
- org.apache.commons.rng.core.source64.LongProvider
-
- org.apache.commons.rng.core.source64.SplitMix64
-
- All Implemented Interfaces:
RandomLongSource,RestorableUniformRandomProvider,UniformRandomProvider
public class SplitMix64 extends LongProvider
A fast RNG, with 64 bits of state, that can be used to initialize the state of other generators.- Since:
- 1.0
- See Also:
- Original source code
-
-
Constructor Summary
Constructors Constructor Description SplitMix64(java.lang.Long seed)Creates a new instance.
-
Method Summary
Modifier and Type Method Description protected byte[]getStateInternal()Creates a snapshot of the RNG state.longnext()protected voidsetStateInternal(byte[] s)Resets the RNG to the givenstate.-
Methods inherited from class org.apache.commons.rng.core.source64.LongProvider
nextBoolean, nextBytes, nextBytes, nextDouble, nextFloat, nextInt, nextLong
-
Methods inherited from class org.apache.commons.rng.core.BaseProvider
checkIndex, checkStateSize, composeStateInternal, fillState, fillState, nextInt, nextLong, restoreState, saveState, splitStateInternal, toString
-
-
-
-
Method Detail
-
next
public long next()
- Returns:
- the next random value.
-
getStateInternal
protected byte[] getStateInternal()
Creates a snapshot of the RNG state.- Overrides:
getStateInternalin classLongProvider- Returns:
- the internal state.
-
setStateInternal
protected void setStateInternal(byte[] s)
Resets the RNG to the givenstate.- Overrides:
setStateInternalin classLongProvider- Parameters:
s- State (previously obtained by a call toBaseProvider.getStateInternal()).- See Also:
BaseProvider.checkStateSize(byte[],int)
-
-