public static class FlawedRandomness.BigCounter extends java.lang.Object implements FlawedRandomness, StatefulRandomness
0x1111111111111111
each time, or 1229782938247303441
.FlawedRandomness.AddRotate, FlawedRandomness.BigCounter
Modifier and Type | Field and Description |
---|---|
long |
state |
Constructor and Description |
---|
BigCounter() |
BigCounter(long state) |
Modifier and Type | Method and Description |
---|---|
FlawedRandomness.BigCounter |
copy()
Produces a copy of this RandomnessSource that, if next() and/or nextLong() are called on this object and the
copy, both will generate the same sequence of random numbers from the point copy() was called.
|
long |
getState()
Get the current internal state of the StatefulRandomness as a long.
|
int |
next(int bits)
Using this method, any algorithm that might use the built-in Java Random
can interface with this randomness source.
|
long |
nextLong()
Using this method, any algorithm that needs to efficiently generate more
than 32 bits of random data can interface with this randomness source.
|
void |
setState(long state)
Set the current internal state of this StatefulRandomness with a long.
|
public long getState()
StatefulRandomness
getState
in interface StatefulRandomness
public void setState(long state)
StatefulRandomness
setState
in interface StatefulRandomness
state
- a 64-bit long. You should avoid passing 0, even though some implementations can handle that.public int next(int bits)
RandomnessSource
next
in interface RandomnessSource
bits
- the number of bits to be returnedpublic long nextLong()
RandomnessSource
nextLong
in interface RandomnessSource
public FlawedRandomness.BigCounter copy()
RandomnessSource
copy
in interface RandomnessSource
copy
in interface StatefulRandomness
Copyright © Eben Howard 2012–2022. All rights reserved.