Documentation API of the 'edu.rit.numeric.NormalPrng' Java class
NormalPrng
edu.rit.numeric

Class NormalPrng



  • public class NormalPrngextends DoublePrng
    Class NormalPrng provides a pseudorandom number generator (PRNG) that generates random numbers with a normal distribution.

    Every two calls of the next() method result in two calls of the underlying uniform PRNG's nextDouble() method. More precisely, the first of a pair of next() calls does two nextDouble() calls, the second of a pair of next() calls does not call nextDouble().

    Class NormalPrng uses the Box-Muller method to generate a standard normal distribution. Let x1 and x2 be drawn from a uniform distribution between 0 and 1. Then y1 and y2, defined as follows, are drawn from a standard normal distribution.

    y1 = sqrt(−2 ln x1) cos 2πx2
    y2 = sqrt(−2 ln x1) sin 2πx2
    And (μ + σy1) and (μ + σy2) are drawn from a normal distribution with mean μ and standard deviation σ.

    Note: While slower than other techniques, this technique does a fixed number of nextDouble() calls to generate each normally distributed random number. This behavior is important when parallel programs generate random numbers.

Warning: You cannot see the full API documentation of this class since the access to the DatMelt documentation for third-party Java classes is denied. Guests can only view jhplot Java API. To view the complete description of this class and its methods, please request the full DataMelt membership.

If you are already a full member, please login to the DataMelt member area before visiting this documentation.