Class LongProvider
- java.lang.Object
-
- org.apache.commons.rng.core.BaseProvider
-
- org.apache.commons.rng.core.source64.LongProvider
-
- All Implemented Interfaces:
RandomLongSource
,RestorableUniformRandomProvider
,UniformRandomProvider
- Direct Known Subclasses:
DotyHumphreySmallFastCounting64
,JenkinsSmallFast64
,L128X1024Mix
,L128X128Mix
,L128X256Mix
,L64X1024Mix
,L64X128Mix
,L64X128StarStar
,L64X256Mix
,MersenneTwister64
,PcgRxsMXs64
,SplitMix64
,TwoCmres
,XoRoShiRo1024PlusPlus
,XoRoShiRo1024Star
,XoRoShiRo1024StarStar
,XoRoShiRo128Plus
,XoRoShiRo128PlusPlus
,XoRoShiRo128StarStar
,XorShift1024Star
,XoShiRo256Plus
,XoShiRo256PlusPlus
,XoShiRo256StarStar
,XoShiRo512Plus
,XoShiRo512PlusPlus
,XoShiRo512StarStar
public abstract class LongProvider extends BaseProvider implements RandomLongSource
Base class for all implementations that provide along
-based source randomness.
-
-
Constructor Summary
Constructors Modifier Constructor Description LongProvider()
Creates a new instance.protected
LongProvider(LongProvider source)
Creates a new instance copying the state from the source.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]
getStateInternal()
Creates a snapshot of the RNG state.boolean
nextBoolean()
int
nextInt()
long
nextLong()
protected void
resetCachedState()
Reset the cached state used in the default implementation ofnextBoolean()
andnextInt()
.protected void
setStateInternal(byte[] s)
Resets the RNG to the givenstate
.-
Methods inherited from class org.apache.commons.rng.core.BaseProvider
checkIndex, checkStateSize, composeStateInternal, extendSeed, extendSeed, fillState, fillState, restoreState, saveState, splitStateInternal, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.commons.rng.core.source64.RandomLongSource
next
-
-
-
-
Constructor Detail
-
LongProvider
public LongProvider()
Creates a new instance.
-
LongProvider
protected LongProvider(LongProvider source)
Creates a new instance copying the state from the source.This provides base functionality to allow a generator to create a copy, for example for use in the
JumpableUniformRandomProvider
interface.- Parameters:
source
- Source to copy.- Since:
- 1.3
-
-
Method Detail
-
resetCachedState
protected void resetCachedState()
Reset the cached state used in the default implementation ofnextBoolean()
andnextInt()
.This should be used when the state is no longer valid, for example after a jump performed for the
JumpableUniformRandomProvider
interface.- Since:
- 1.3
-
getStateInternal
protected byte[] getStateInternal()
Creates a snapshot of the RNG state.- Overrides:
getStateInternal
in classBaseProvider
- Returns:
- the internal state.
-
setStateInternal
protected void setStateInternal(byte[] s)
Resets the RNG to the givenstate
.- Overrides:
setStateInternal
in classBaseProvider
- Parameters:
s
- State (previously obtained by a call toBaseProvider.getStateInternal()
).- See Also:
BaseProvider.checkStateSize(byte[],int)
-
nextLong
public long nextLong()
- Specified by:
nextLong
in interfaceUniformRandomProvider
-
nextInt
public int nextInt()
- Specified by:
nextInt
in interfaceUniformRandomProvider
-
nextBoolean
public boolean nextBoolean()
- Specified by:
nextBoolean
in interfaceUniformRandomProvider
-
-