Class DistTriangular

All Implemented Interfaces:
Serializable

public class DistTriangular extends DistContinuous
The Triangular distribution. For more information on this distribution see https://mathworld.wolfram.com/TriangularDistribution.html

Copyright (c) 2002-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://https://simulation.tudelft.nl/dsol/docs/latest/license.html.

Author:
Peter Jacobs , Alexander Verbraeck
See Also:
  • Field Summary

    Fields inherited from class nl.tudelft.simulation.jstats.distributions.Dist

    stream
  • Constructor Summary

    Constructors
    Constructor
    Description
    DistTriangular(StreamInterface stream, double min, double mode, double max)
    constructs a new triangular distribution with a minimum, mode, and maximum.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    draws the next stream value according to the probability of this this distribution.
    double
    Return the maximum value of the distribution.
    double
    Return the minimum value of the distribution.
    double
    Return the mode of the distribution.
    double
    returns the probability density value of a value x.

    Methods inherited from class nl.tudelft.simulation.jstats.distributions.Dist

    getStream, setStream

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DistTriangular

      public DistTriangular(StreamInterface stream, double min, double mode, double max)
      constructs a new triangular distribution with a minimum, mode, and maximum.
      Parameters:
      stream - StreamInterface; the random number stream
      min - double; the minimum
      mode - double; the mode
      max - double; the maximum
      Throws:
      IllegalArgumentException - when mode < min or mode > max or min == max
  • Method Details

    • draw

      public double draw()
      draws the next stream value according to the probability of this this distribution.
      Specified by:
      draw in class DistContinuous
      Returns:
      the next double value drawn.
    • getProbabilityDensity

      public double getProbabilityDensity(double x)
      returns the probability density value of a value x.
      Specified by:
      getProbabilityDensity in class DistContinuous
      Parameters:
      x - double; the value for which the density function needs to be calculated
      Returns:
      double; the probability density for value x
    • getMin

      public double getMin()
      Return the minimum value of the distribution.
      Returns:
      double; the minimum value of the distribution
    • getMode

      public double getMode()
      Return the mode of the distribution.
      Returns:
      double; the mode of the distribution
    • getMax

      public double getMax()
      Return the maximum value of the distribution.
      Returns:
      double; the maximum value of the distribution.
    • toString

      public String toString()
      Overrides:
      toString in class Object