public class PcgXshRr32 extends IntProvider
State size is 128 bits and the period is 264.
Note: Although the seed size is 128 bits, only the first 64 are effective: in effect, two seeds that only differ by the last 64 bits may produce highly correlated sequences.
Constructor and Description |
---|
PcgXshRr32(Long seed)
Creates a new instance using a default increment.
|
PcgXshRr32(long[] seed)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
getStateInternal()
Creates a snapshot of the RNG state.
|
int |
next() |
protected void |
setStateInternal(byte[] s)
Resets the RNG to the given
state . |
protected int |
transform(long x)
Transform the 64-bit state of the generator to a 32-bit output.
|
nextBoolean, nextBytes, nextBytes, nextDouble, nextInt, nextLong, resetCachedState
checkIndex, checkStateSize, composeStateInternal, extendSeed, extendSeed, fillState, fillState, restoreState, saveState, splitStateInternal, toString
public PcgXshRr32(Long seed)
seed
- Initial state.public PcgXshRr32(long[] seed)
Note: Although the seed size is 128 bits, only the first 64 are effective: in effect, two seeds that only differ by the last 64 bits may produce highly correlated sequences.
seed
- Initial seed.
If the length is larger than 2, only the first 2 elements will
be used; if smaller, the remaining elements will be automatically set.
The 1st element is used to set the LCG state. The 2nd element is used to set the LCG increment; the most significant bit is discarded by left shift and the increment is set to odd.
protected int transform(long x)
x
- State.public int next()
protected byte[] getStateInternal()
getStateInternal
in class IntProvider
protected void setStateInternal(byte[] s)
state
.setStateInternal
in class IntProvider
s
- State (previously obtained by a call to
BaseProvider.getStateInternal()
).BaseProvider.checkStateSize(byte[],int)
Copyright © 2016–2022 The Apache Software Foundation. All rights reserved.