public class XorRNG extends Object implements RandomnessSource
Constructor and Description |
---|
XorRNG()
Creates a new generator seeded using Math.random.
|
XorRNG(long seed) |
Modifier and Type | Method and Description |
---|---|
RandomnessSource |
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.
|
int |
next(int bits)
Using this method, any algorithm that might use the built-in Java Random
can interface with this randomness source.
|
boolean |
nextBoolean() |
void |
nextBytes(byte[] bytes) |
double |
nextDouble() |
float |
nextFloat() |
int |
nextInt() |
int |
nextInt(int n) |
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.
|
long |
nextLong(long n) |
void |
setSeed(long seed)
Sets the seed of this generator.
|
String |
toString() |
public XorRNG()
public XorRNG(long seed)
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 int nextInt()
public int nextInt(int n)
public long nextLong(long n)
public double nextDouble()
public float nextFloat()
public boolean nextBoolean()
public void nextBytes(byte[] bytes)
public void setSeed(long seed)
seed
- the number to use as the seedpublic RandomnessSource copy()
copy
in interface RandomnessSource
Copyright © 2012–2016. All rights reserved.