public class GoatRNG extends java.lang.Object implements RandomnessSource, java.io.Serializable
OrbitRNG
or GearRNG
(Goat seems to have higher statistical quality than either of those late in
testing, though). It passes 64TB of PractRand testing with no anomalies, and might be able to endure tests past even
that (the default setting stops at 32TB); I had set up PractRand to test up to 128TB but it ran out of memory after
5 days of nonstop testing on all 6 cores. If 16GB of RAM isn't enough to find even an anomaly in GoatRNG, then it is
probably quite good.
Modifier and Type | Field and Description |
---|---|
long |
stateA
Can be any long value.
|
long |
stateB
Can be any long value.
|
Constructor and Description |
---|
GoatRNG()
Creates a new generator seeded using Math.random.
|
GoatRNG(long seed) |
GoatRNG(long seedA,
long seedB) |
Modifier and Type | Method and Description |
---|---|
GoatRNG |
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.
|
boolean |
equals(java.lang.Object o) |
long |
getStateA()
Get the "A" part of the internal state as a long.
|
long |
getStateB()
Get the "B" part of the internal state as a long.
|
int |
hashCode() |
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 |
setStateA(long stateA)
Set the "A" part of the internal state with a long.
|
void |
setStateB(long stateB)
Set the "B" part of the internal state with a long.
|
java.lang.String |
toString() |
public long stateA
public long stateB
public GoatRNG()
public GoatRNG(long seed)
public GoatRNG(long seedA, long seedB)
public long getStateA()
public void setStateA(long stateA)
stateA
- any 64-bit longpublic long getStateB()
public void setStateB(long stateB)
stateB
- any 64-bit longpublic int next(int bits)
next
in interface RandomnessSource
bits
- the number of bits to be returnedpublic long nextLong()
Get a random long between Long.MIN_VALUE and Long.MAX_VALUE (both inclusive).
nextLong
in interface RandomnessSource
public GoatRNG copy()
copy
in interface RandomnessSource
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Copyright © Eben Howard 2012–2022. All rights reserved.