UniformPrng
edu.rit.numeric

Class UniformPrng



  • public class UniformPrngextends DoublePrng
    Class UniformPrng provides a pseudorandom number generator (PRNG) that generates random numbers with a uniform(a,b) distribution. The probability density function is
        f(x) = 1/(ba), axb
        f(x) = 0, otherwise

    Every call of the next() method results in one call of the underlying uniform PRNG's nextDouble() method.

    • Constructor Detail

      • UniformPrng

        public UniformPrng(Random theUniformPrng,           double a,           double b)
        Construct a new uniform PRNG.
        Parameters:
        theUniformPrng - The underlying uniform PRNG.
        a - Interval lower bound.
        b - Interval upper bound.
        Throws:
        NullPointerException - (unchecked exception) Thrown if theUniformPrng is null.
        IllegalArgumentException - (unchecked exception) Thrown if ab.
    • Method Detail

      • next

        public double next()
        Returns the next random number.
        Specified by:
        next in class DoublePrng
        Returns:
        Random number.

SCaVis 2.2 © jWork.ORG