org.jgap.util
Class randomMCG
- java.lang.Object
-
- org.jgap.util.randomX
-
- org.jgap.util.randomMCG
-
public class randomMCG extends randomX
Implementation of a randomX-compliant class using the "Minimal Standard" multiplicative congruential generator of Park and Miller. [Park, S.K. and K.W. Miller, Communications of the ACM 31, 1192-1201 (1988).]The generation algorithm is:
Ij+1 = (Ij x 16807) & 0x7FFFFFFF Note that the intermediate value of the multiplication by 16807 (75) exceeds that representable in 32 bits; this has deterred use of this generator in most portable languages. Fortunately, Java's long type is guaranteed to be 64 bits, so a straightforward and portable implementation is possible.
Designed and implemented in July 1996 by John Walker, kelvin@fourmilab.ch.
-
-
Constructor Summary
Constructors Constructor and Description randomMCG()Creates a new pseudorandom number generator, seeded from the current time.randomMCG(long seed)Creates a new pseudorandom number generator with a specified nonzero seed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description bytenextByte()Get next byte from generator.voidsetSeed(long seed)Set seed for generator.
-
-
-
Constructor Detail
-
randomMCG
public randomMCG()
Creates a new pseudorandom number generator, seeded from the current time.
-
randomMCG
public randomMCG(long seed) throws java.lang.IllegalArgumentExceptionCreates a new pseudorandom number generator with a specified nonzero seed.- Parameters:
seed- initial seed for the generator- Throws:
java.lang.IllegalArgumentException
-
-
DMelt 3.0 © DataMelt by jWork.ORG