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

Class randomX

  • Direct Known Subclasses:
    randomHotBits, randomJava, randomLCG, randomLEcuyer, randomMCG


    public abstract class randomX
    extends java.lang.Object
    Abstract superclass for emulations of java.util.Random with various underlying generators. These generators provide a superset of the methods of the built-in Java generator, and allow easy replacement of the low-level byte-stream random generator without the need to reimplement the higher-level calls.

    The nature of the data returned by the functions in this class depends upon the generator provided by the class derived from it. If the generator is algorithmic, the data are pseudorandom; if a hardware generator is employed, genuine random data may be obtained. For brevity, in this document, we use random to refer to the data returned, whatever its actual source.

    Designed and implemented in July 1996 by John Walker, kelvin@fourmilab.ch.

    See Also:
    Random
    • Constructor Detail

      • randomX

        public randomX()
    • Method Detail

      • setSeed

        public void setSeed()
        Reset when seed changes. A generator which supports seed must call this method by super.setSeed() when its own setSeed(long) method is called. This allows randomX to discard any buffered data in the nextBit() and nextGaussian() methods so that subsequent calls will immediately reflect the new seed.

        If a derived class does not permit specification of a seed (hardware-based generators, for example), it should declare:

        private void setSeed(long seed) { }

        which will hide the setSeed method from its users and cause a compile-time error if a program attempts to specify a seed.

      • nextByte

        public abstract byte nextByte()
        Return next [pseudo]random byte from low level generator. All generators derived from this class must implement nextByte().
      • nextInt

        public int nextInt()
        Returns:
        the next random, uniformly distributed, int value.
      • nextLong

        public long nextLong()
        Returns:
        the next random, uniformly distributed, long value.
      • nextFloat

        public float nextFloat()
        Returns:
        the next random, uniformly distributed, float value, greater than or equal to 0 and less than 1.
      • nextDouble

        public double nextDouble()
        Returns:
        the next random, uniformly distributed, double value, greater than or equal to 0 and less than 1.
      • nextGaussian

        public double nextGaussian()
        Returns:
        the next Gaussian (normal, or bell-curve) distributed random value, with mean of 0.0 and standard deviation 1.0.
      • nextBit

        public boolean nextBit()
        Returns:
        the next random bit, as a boolean.
      • nextByte

        public void nextByte(byte[] buf,
                             int buflen)
        Fill a portion of an array of bytes with random data.
        Parameters:
        buf - array of byte to fill.
        buflen - number of bytes to store.
      • nextByte

        public void nextByte(byte[] buf)
        Fill an array of bytes with random data.
        Parameters:
        buf - array of bytes to fill.
      • nextShort

        public short nextShort()
        Returns:
        the next random, uniformly distributed, short value.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.