Documentation of 'org.jgap.util.randomMCG' Java class
randomMCG
org.jgap.util

Class 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 Detail

      • randomMCG

        public randomMCG()
        Creates a new pseudorandom number generator, seeded from the current time.
      • randomMCG

        public randomMCG(long seed)
                  throws java.lang.IllegalArgumentException
        Creates a new pseudorandom number generator with a specified nonzero seed.
        Parameters:
        seed - initial seed for the generator
        Throws:
        java.lang.IllegalArgumentException
    • Method Detail

      • setSeed

        public void setSeed(long seed)
                     throws java.lang.IllegalArgumentException
        Set seed for generator. Subsequent values will be based on the given nonzero seed.
        Parameters:
        seed - seed for the generator
        Throws:
        java.lang.IllegalArgumentException
      • nextByte

        public byte nextByte()
        Get next byte from generator.
        Specified by:
        nextByte in class randomX
        Returns:
        the next byte from the generator.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.