Class RandomNormal


  • public class RandomNormal
    extends Object
    Utility class that generates normally-distributed random values using several algorithms.
    • Constructor Detail

      • RandomNormal

        public RandomNormal()
    • Method Detail

      • setParameters

        public void setParameters​(float mean,
                                  float stddev)
        Set the mean and standard deviation.
        Parameters:
        mean - the mean
        stddev - the standard deviation
      • nextCentral

        public float nextCentral()
        Compute the next random value using the Central Limit Theorem, which states that the averages of sets of uniformly-distributed random values are normally distributed.
      • nextPolar

        public float nextPolar()
        Compute the next randomn value using the polar algorithm. Requires two uniformly-distributed random values in [-1, +1). Actually computes two random values and saves the second one for the next invokation.
      • nextRatio

        public float nextRatio()
        Compute the next random value using the ratio algorithm. Requires two uniformly-distributed random values in [0, 1).