org.uncommons.maths.random
Class JavaRNG
- java.lang.Object
-
- java.util.Random
-
- org.uncommons.maths.random.JavaRNG
-
- All Implemented Interfaces:
- java.io.Serializable, RepeatableRNG
public class JavaRNG extends java.util.Random implements RepeatableRNG
This is the default
JDK RNGextended to implement theRepeatableRNGinterface (for consistency with the other RNGs in this package).The
MersenneTwisterRNGshould 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 theRandom.setSeed(long)method will have no effect. Instead the seed must be set by a constructor.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description byte[]getSeed()
-
-
-
Constructor Detail
-
JavaRNG
public JavaRNG()
Creates a new RNG and seeds it using the default seeding strategy.
-
JavaRNG
public JavaRNG(SeedGenerator seedGenerator) throws SeedException
Seed the RNG using the provided seed generation strategy.- Parameters:
seedGenerator- The seed generation strategy that will provide the seed value for this RNG.- Throws:
SeedException- If there is a problem generating a seed.
-
JavaRNG
public JavaRNG(byte[] seed)
Creates an RNG and seeds it with the specified seed data.- Parameters:
seed- The seed data used to initialise the RNG.
-
-
Method Detail
-
getSeed
public byte[] getSeed()
- Specified by:
getSeedin interfaceRepeatableRNG- Returns:
- The seed data used to initialise this pseudo-random number generator.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG