Class UniformDistribution

  • All Implemented Interfaces:
    Distribution

    public class UniformDistribution
    extends java.lang.Object
    implements Distribution
    Uniform distribution.
    Since:
    0.2
    Author:
    Erich Schubert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double len
      Len := max - min
      private double max
      Maximum
      private double min
      Minimum
    • Constructor Summary

      Constructors 
      Constructor Description
      UniformDistribution​(double min, double max)
      Constructor for a uniform distribution on the interval [min, max[
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double cdf​(double val)
      Return the cumulative density function at the given value.
      double getMax()  
      double getMin()  
      double logpdf​(double val)
      Return the log density of an existing value
      double nextRandom​(java.util.Random random)
      Generate a new random value
      double pdf​(double val)
      Return the density of an existing value
      double quantile​(double val)
      Quantile aka probit (for normal) aka inverse CDF (invcdf, cdf^-1) function.
      java.lang.String toString()
      Describe the distribution
      • Methods inherited from class java.lang.Object

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

      • min

        private double min
        Minimum
      • max

        private double max
        Maximum
      • len

        private double len
        Len := max - min
    • Constructor Detail

      • UniformDistribution

        public UniformDistribution​(double min,
                                   double max)
        Constructor for a uniform distribution on the interval [min, max[
        Parameters:
        min - Minimum value
        max - Maximum value
    • Method Detail

      • pdf

        public double pdf​(double val)
        Description copied from interface: Distribution
        Return the density of an existing value
        Specified by:
        pdf in interface Distribution
        Parameters:
        val - existing value
        Returns:
        distribution density
      • logpdf

        public double logpdf​(double val)
        Description copied from interface: Distribution
        Return the log density of an existing value
        Specified by:
        logpdf in interface Distribution
        Parameters:
        val - existing value
        Returns:
        log distribution density
      • cdf

        public double cdf​(double val)
        Description copied from interface: Distribution
        Return the cumulative density function at the given value.
        Specified by:
        cdf in interface Distribution
        Parameters:
        val - existing value
        Returns:
        cumulative density
      • quantile

        public double quantile​(double val)
        Description copied from interface: Distribution
        Quantile aka probit (for normal) aka inverse CDF (invcdf, cdf^-1) function.
        Specified by:
        quantile in interface Distribution
        Parameters:
        val - Quantile to find
        Returns:
        Quantile position
      • nextRandom

        public double nextRandom​(java.util.Random random)
        Description copied from interface: Distribution
        Generate a new random value
        Specified by:
        nextRandom in interface Distribution
        Parameters:
        random - Random number generator
        Returns:
        new random value
      • toString

        public java.lang.String toString()
        Description copied from interface: Distribution
        Describe the distribution
        Specified by:
        toString in interface Distribution
        Overrides:
        toString in class java.lang.Object
        Returns:
        description
      • getMin

        public double getMin()
        Returns:
        the minimum value
      • getMax

        public double getMax()
        Returns:
        the maximum value