Class JenkinsSmallFast32
- java.lang.Object
-
- org.apache.commons.rng.core.BaseProvider
-
- org.apache.commons.rng.core.source32.IntProvider
-
- org.apache.commons.rng.core.source32.JenkinsSmallFast32
-
- All Implemented Interfaces:
RandomIntSource
,RestorableUniformRandomProvider
,UniformRandomProvider
public class JenkinsSmallFast32 extends IntProvider
Implement Bob Jenkins's small fast (JSF) 32-bit generator.The state size is 128-bits; the shortest period is expected to be about 294 and it expected that about one seed will run into another seed within 264 values.
- Since:
- 1.3
- See Also:
- A small noncryptographic PRNG
-
-
Constructor Summary
Constructors Constructor Description JenkinsSmallFast32(Integer seed)
Creates an instance with the given seed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]
getStateInternal()
Creates a snapshot of the RNG state.int
next()
protected void
setStateInternal(byte[] s)
Resets the RNG to the givenstate
.-
Methods inherited from class org.apache.commons.rng.core.source32.IntProvider
nextBoolean, nextBytes, nextBytes, nextDouble, nextFloat, nextInt, nextLong, resetCachedState
-
Methods inherited from class org.apache.commons.rng.core.BaseProvider
checkIndex, checkStateSize, composeStateInternal, fillState, fillState, nextInt, nextLong, restoreState, saveState, splitStateInternal, toString
-
-
-
-
Constructor Detail
-
JenkinsSmallFast32
public JenkinsSmallFast32(Integer seed)
Creates an instance with the given seed.- Parameters:
seed
- Initial seed.
-
-
Method Detail
-
next
public final int next()
- Returns:
- the next random value.
-
getStateInternal
protected byte[] getStateInternal()
Creates a snapshot of the RNG state.- Overrides:
getStateInternal
in classIntProvider
- Returns:
- the internal state.
-
setStateInternal
protected void setStateInternal(byte[] s)
Resets the RNG to the givenstate
.- Overrides:
setStateInternal
in classIntProvider
- Parameters:
s
- State (previously obtained by a call toBaseProvider.getStateInternal()
).- See Also:
BaseProvider.checkStateSize(byte[],int)
-
-