|
Uncommons Maths API (Version 1.2.3) |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Random org.uncommons.maths.random.XORShiftRNG
public class XORShiftRNG
Very fast pseudo random number generator. See
this
page for a description. This RNG has a period of about 2^160, which is not as long
as the MersenneTwisterRNG
but it is faster.
NOTE: Because instances of this class require 160-bit seeds, it is not
possible to seed this RNG using the Random.setSeed(long)
method inherited
from Random
. Calls to this method will have no effect.
Instead the seed must be set by a constructor.
Constructor Summary | |
---|---|
XORShiftRNG()
Creates a new RNG and seeds it using the default seeding strategy. |
|
XORShiftRNG(byte[] seed)
Creates an RNG and seeds it with the specified seed data. |
|
XORShiftRNG(SeedGenerator seedGenerator)
Seed the RNG using the provided seed generation strategy. |
Method Summary | |
---|---|
byte[] |
getSeed()
|
protected int |
next(int bits)
|
Methods inherited from class java.util.Random |
---|
nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong, setSeed |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XORShiftRNG()
public XORShiftRNG(SeedGenerator seedGenerator) throws SeedException
seedGenerator
- The seed generation strategy that will provide
the seed value for this RNG.
SeedException
- If there is a problem generating a seed.public XORShiftRNG(byte[] seed)
seed
- The seed data used to initialise the RNG.Method Detail |
---|
public byte[] getSeed()
getSeed
in interface RepeatableRNG
protected int next(int bits)
next
in class Random
|
Uncommons Maths API (Version 1.2.3) |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |