public class JavaRNG extends Random implements RepeatableRNG
This is the default JDK RNG
extended
to implement the RepeatableRNG
interface (for consistency with
the other RNGs in this package).
The MersenneTwisterRNG
should be used in preference to this
class because it is statistically more random and performs slightly
better.
NOTE: Instances of this class do not use the seeding mechanism inherited
from Random
. Calls to the Random.setSeed(long)
method will have no
effect. Instead the seed must be set by a constructor.
Constructor and Description |
---|
JavaRNG()
Creates a new RNG and seeds it using the default seeding strategy.
|
JavaRNG(byte[] seed)
Creates an RNG and seeds it with the specified seed data.
|
JavaRNG(SeedGenerator seedGenerator)
Seed the RNG using the provided seed generation strategy.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getSeed() |
public JavaRNG()
public JavaRNG(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 JavaRNG(byte[] seed)
seed
- The seed data used to initialise the RNG.public byte[] getSeed()
getSeed
in interface RepeatableRNG
Copyright © 2015. All rights reserved.