|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jgap.util.randomX
org.jgap.util.randomMCG
public class randomMCG
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:
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 | |
|---|---|
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 | |
|---|---|
byte |
nextByte()
Get next byte from generator. |
void |
setSeed(long seed)
Set seed for generator. |
| Methods inherited from class org.jgap.util.randomX |
|---|
nextBit, nextByte, nextByte, nextDouble, nextFloat, nextGaussian, nextInt, nextLong, nextShort, setSeed |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public randomMCG()
public randomMCG(long seed)
throws java.lang.IllegalArgumentException
seed - initial seed for the generator
java.lang.IllegalArgumentException| Method Detail |
|---|
public void setSeed(long seed)
throws java.lang.IllegalArgumentException
seed - seed for the generator
java.lang.IllegalArgumentExceptionpublic byte nextByte()
nextByte in class randomX
|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||