Class GaussianGenerator

    • Constructor Summary

      Constructors 
      Constructor Description
      GaussianGenerator​(double mean, double standardDeviation, java.util.Random rng)
      Creates a generator of normally-distributed values from a distribution with the specified mean and standard deviation.
      GaussianGenerator​(NumberGenerator<java.lang.Double> mean, NumberGenerator<java.lang.Double> standardDeviation, java.util.Random rng)
      Creates a generator of normally-distributed values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Double nextValue()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • rng

        private final java.util.Random rng
      • standardDeviation

        private final NumberGenerator<java.lang.Double> standardDeviation
    • Constructor Detail

      • GaussianGenerator

        public GaussianGenerator​(NumberGenerator<java.lang.Double> mean,
                                 NumberGenerator<java.lang.Double> standardDeviation,
                                 java.util.Random rng)

        Creates a generator of normally-distributed values. The mean and standard deviation are determined by the provided NumberGenerators. This means that the statistical parameters of this generator may change over time. One example of where this is useful is if the mean and standard deviation generators are attached to GUI controls that allow a user to tweak the parameters while a program is running.

        To create a Gaussian generator with a constant mean and standard deviation, use the GaussianGenerator(double, double, Random) constructor instead.

        Parameters:
        mean - A NumberGenerator that provides the mean of the Gaussian distribution used for the next generated value.
        standardDeviation - A NumberGenerator that provides the standard deviation of the Gaussian distribution used for the next generated value.
        rng - The source of randomness.
      • GaussianGenerator

        public GaussianGenerator​(double mean,
                                 double standardDeviation,
                                 java.util.Random rng)
        Creates a generator of normally-distributed values from a distribution with the specified mean and standard deviation.
        Parameters:
        mean - The mean of the values generated.
        standardDeviation - The standard deviation of the values generated.
        rng - The source of randomness.
    • Method Detail

      • nextValue

        public java.lang.Double nextValue()
        Specified by:
        nextValue in interface NumberGenerator<java.lang.Double>
        Returns:
        The next value from the generator.