public class UnsafeRandom extends Random
Random
, but not using atomic long
seeds. This implementation is no longer thread-safe (but faster)!Modifier and Type | Field and Description |
---|---|
private static long |
addend |
private static long |
mask |
private static long |
multiplier |
private long |
seed
The random seed.
|
private static long |
serialVersionUID
Serial version number.
|
Constructor and Description |
---|
UnsafeRandom()
Constructor called only by localRandom.initialValue.
|
UnsafeRandom(long seed)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected int |
next(int bits) |
void |
setSeed(long seed)
Throws
UnsupportedOperationException . |
nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong
private static final long serialVersionUID
private static final long multiplier
private static final long addend
private static final long mask
private long seed
public UnsafeRandom()
public UnsafeRandom(long seed)
seed
- Random generator seed.public void setSeed(long seed)
UnsupportedOperationException
. Setting seeds in this
generator is not supported.setSeed
in class Random
UnsupportedOperationException
- always