Documentation of 'edu.rit.util.DefaultRandom' Java class
DefaultRandom
edu.rit.util

Class DefaultRandom

  • All Implemented Interfaces:
    java.io.Serializable


    public class DefaultRandom
    extends Random
    Class DefaultRandom provides a default pseudorandom number generator (PRNG) designed for use in parallel scientific programming. To create an instance of class DefaultRandom, either use the DefaultRandom() constructor, or use the static getInstance(long) method in class Random.

    Class DefaultRandom generates random numbers by hashing successive counter values. The seed initializes the counter. The hash function is defined in W. Press et al., Numerical Recipes: The Art of Scientific Computing, Third Edition (Cambridge University Press, 2007), page 352. The hash function applied to the counter value i is:

    x := 3935559000370003845 * i + 2691343689449507681 (mod 264)
    x := x xor (x right-shift 21)
    x := x xor (x left-shift 37)
    x := x xor (x right-shift 4)
    x := 4768777513237032717 * x (mod 264)
    x := x xor (x left-shift 20)
    x := x xor (x right-shift 41)
    x := x xor (x left-shift 5)
    Return x

    (The shift and arithmetic operations are all performed on unsigned 64-bit numbers.)

    See Also:
    Serialized Form
    • Constructor Detail

      • DefaultRandom

        public DefaultRandom(long seed)
        Construct a new PRNG with the given seed. Any seed value is allowed.
        Parameters:
        seed - Seed.
    • Method Detail

      • setSeed

        public void setSeed(long seed)
        Set this PRNG's seed. Any seed value is allowed.
        Specified by:
        setSeed in class Random
        Parameters:
        seed - Seed.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.