Class ProbabilityDistributions

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.Random randomGenerator
      Random number generator
    • Method Summary

      Modifier and Type Method Description
      static double cdfNormal​(double x, double mean, double stddev)
      CDF - Cumulative Distribution Function - Normal distribution N(mean, stddev).
      static double cdfUniformContinuous​(double x, double a, double b)
      CDF - Cumulative Distribution Function - Uniform Continuous distribution over interval [a, b).
      static double pdfNormal​(double x, double mean, double stddev)
      PDF - Probability Distribution Function - Normal distribution N(mean, stddev).
      static double pdfUniformContinuous​(double x, double a, double b)
      PDF - Probability Distribution Function - Uniform Continuous distribution over interval [a, b).
      static double qntNormal​(double q, double mean, double stddev)
      QNT - Quantile Function - Normal distribution N(mean, stddev).
      static double qntUniformContinuous​(double q, double a, double b)
      QNT - Quantile Function - Uniform Continuous distribution over interval [a, b).
      static double randomUniformContinuous()
      Random number from Uniform Continuous distribution over interval [0, 1).
      static int rndIndex​(int n)
      Random index from 0 to n-1,
      static int rndIndex​(int n, java.util.Random rnd)
      Random index from 0 to n-1,
      static int rndInteger()
      Random integer.
      static double rndInteger​(int a, int b)
      Random number from Uniform Discrete distribution.
      static double rndInteger​(int a, int b, java.util.Random rnd)
      Random number from Uniform Discrete distribution.
      static int rndInteger​(java.util.Random rnd)
      Random integer.
      static double rndNormal​(double mean, double stddev)
      Random number from normal distribution N(mean, stddev).
      static double rndNormal​(double mean, double stddev, java.util.Random rnd)
      Random number from normal distribution N(mean, stddev).
      static double rndUniformContinuous​(double a, double b)
      Random number from dUniform Continuous distribution over interval [a, b).
      static double rndUniformContinuous​(double a, double b, java.util.Random rnd)
      Random number from Uniform Continuous distribution over interval [a, b).
      static double rndUniformContinuous​(java.util.Random rnd)
      Random number from Uniform Continuous distribution over interval [0, 1).
      • Methods inherited from class java.lang.Object

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

      • randomGenerator

        public static java.util.Random randomGenerator
        Random number generator
    • Constructor Detail

      • ProbabilityDistributions

        public ProbabilityDistributions()
    • Method Detail

      • rndUniformContinuous

        public static final double rndUniformContinuous​(double a,
                                                        double b,
                                                        java.util.Random rnd)
        Random number from Uniform Continuous distribution over interval [a, b).
        Parameters:
        a - Interval limit - left / lower.
        b - Interval limit - right / upper.
        rnd - Random number generator.
        Returns:
        Double.NaN if a or b is null, or b is lower than a - otherwise returns random number.
      • rndUniformContinuous

        public static final double rndUniformContinuous​(double a,
                                                        double b)
        Random number from dUniform Continuous distribution over interval [a, b).
        Parameters:
        a - Interval limit - left / lower.
        b - Interval limit - right / upper.
        Returns:
        Double.NaN if a or b is null, or b is lower than a - otherwise returns random number.
      • rndUniformContinuous

        public static final double rndUniformContinuous​(java.util.Random rnd)
        Random number from Uniform Continuous distribution over interval [0, 1).
        Parameters:
        rnd - Random number generator.
        Returns:
        Random number.
      • randomUniformContinuous

        public static final double randomUniformContinuous()
        Random number from Uniform Continuous distribution over interval [0, 1).
        Returns:
        Random number.
      • pdfUniformContinuous

        public static final double pdfUniformContinuous​(double x,
                                                        double a,
                                                        double b)
        PDF - Probability Distribution Function - Uniform Continuous distribution over interval [a, b).
        Parameters:
        x - Point to evaluate pdf function.
        a - Interval limit - left / lower.
        b - Interval limit - right / upper.
        Returns:
        Double.NaN if a or b is null, or b is lower than a - otherwise function value.
      • cdfUniformContinuous

        public static final double cdfUniformContinuous​(double x,
                                                        double a,
                                                        double b)
        CDF - Cumulative Distribution Function - Uniform Continuous distribution over interval [a, b).
        Parameters:
        x - Point to evaluate cdf function.
        a - Interval limit - left / lower.
        b - Interval limit - right / upper.
        Returns:
        Double.NaN if a or b is null, or b is lower than a - otherwise function value.
      • qntUniformContinuous

        public static final double qntUniformContinuous​(double q,
                                                        double a,
                                                        double b)
        QNT - Quantile Function - Uniform Continuous distribution over interval [a, b). (Inverse of Cumulative Distribution Function).
        Parameters:
        q - Quantile.
        a - Interval limit - left / lower.
        b - Interval limit - right / upper.
        Returns:
        Double.NaN if a or b is null, or b is lower than a or q is lower than 0 or q is greater than 1 - otherwise function value.
      • rndInteger

        public static final double rndInteger​(int a,
                                              int b,
                                              java.util.Random rnd)
        Random number from Uniform Discrete distribution. over set interval (a, a+1, ..., b-1, b).
        Parameters:
        a - Interval limit - left / lower.
        b - Interval limit - right / upper.
        rnd - Random number generator.
        Returns:
        Double.NaN if a or b is null, or b is lower than a - otherwise returns random number.
      • rndInteger

        public static final double rndInteger​(int a,
                                              int b)
        Random number from Uniform Discrete distribution. over set interval (a, a+1, ..., b-1, b).
        Parameters:
        a - Interval limit - left / lower.
        b - Interval limit - right / upper.
        Returns:
        Double.NaN if a or b is null, or b is lower than a - otherwise returns random number.
      • rndInteger

        public static final int rndInteger​(java.util.Random rnd)
        Random integer.
        Parameters:
        rnd - Random number generator.
        Returns:
        Returns random number.
      • rndIndex

        public static final int rndIndex​(int n,
                                         java.util.Random rnd)
        Random index from 0 to n-1,
        Parameters:
        n - Bound.
        rnd - Random number generator.
        Returns:
        if n < 0 returns -1, otherwise random index.
      • rndIndex

        public static final int rndIndex​(int n)
        Random index from 0 to n-1,
        Parameters:
        n - Bound.
        Returns:
        if n < 0 returns -1, otherwise random index.
      • rndInteger

        public static final int rndInteger()
        Random integer.
        Returns:
        Double.NaN if a or b is null, or b is lower than a - otherwise returns random number.
      • rndNormal

        public static final double rndNormal​(double mean,
                                             double stddev,
                                             java.util.Random rnd)
        Random number from normal distribution N(mean, stddev).
        Parameters:
        mean - Mean value.
        stddev - Standard deviation.
        rnd - Random number generator.
        Returns:
        Double.NaN if mean or stddev or rnd is null or stddev is lower than 0 - otherwise random number.
      • rndNormal

        public static final double rndNormal​(double mean,
                                             double stddev)
        Random number from normal distribution N(mean, stddev).
        Parameters:
        mean - Mean value.
        stddev - Standard deviation.
        Returns:
        Double.NaN if mean or stddev is null or stddev is lower than 0 - otherwise random number.
      • pdfNormal

        public static final double pdfNormal​(double x,
                                             double mean,
                                             double stddev)
        PDF - Probability Distribution Function - Normal distribution N(mean, stddev).
        Parameters:
        x - Point to evaluate pdf function.
        mean - Mean value.
        stddev - Standard deviation.
        Returns:
        Double.NaN if mean or stddev is null or stddev is lower than 0 - otherwise function value.
      • cdfNormal

        public static final double cdfNormal​(double x,
                                             double mean,
                                             double stddev)
        CDF - Cumulative Distribution Function - Normal distribution N(mean, stddev).
        Parameters:
        x - Point to evaluate pdf function.
        mean - Mean value.
        stddev - Standard deviation.
        Returns:
        Double.NaN if mean or stddev is null or stddev is lower than 0 - otherwise function value.
      • qntNormal

        public static final double qntNormal​(double q,
                                             double mean,
                                             double stddev)
        QNT - Quantile Function - Normal distribution N(mean, stddev). (Inverse of Cumulative Distribution Function).
        Parameters:
        q - Quantile.
        mean - Mean value.
        stddev - Standard deviation.
        Returns:
        Double.NaN if mean or stddev is null or stddev is lower than 0 or q is lower than 0 or q is greater than 1 - otherwise function value.