Package jasima.core.random.continuous
Class DblTriangular
- java.lang.Object
-
- jasima.core.random.continuous.DblSequence
-
- jasima.core.random.continuous.DblTriangular
-
- All Implemented Interfaces:
Serializable,Cloneable
public class DblTriangular extends DblSequence
Returns a random real number following a triangular distribution as defined by the three parameters min, mode, and max.- Author:
- Torsten Hildebrandt
- See Also:
- Triangular distribution (Wikipedia), Triangular distribution (MathWorld), Serialized Form
-
-
Field Summary
-
Fields inherited from class jasima.core.random.continuous.DblSequence
rndGen
-
-
Constructor Summary
Constructors Constructor Description DblTriangular(double min, double mode, double max)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DblTriangularfromMinMeanMax(double min, double mean, double max)Factory method to create a DblStream given the distribution's mean value.static DblTriangularfromMinModeMax(double min, double mode, double max)Factory method to create a DblStream given the distribution's mode value.doublegetMax()doublegetMin()doublegetMode()doublegetNumericalMean()Returns the arithmetic mean of the values returned byDblSequence.nextDbl().Pair<Double,Double>getValueRange()This method computes the minimum and maximum support values (range of possible values) of this stream.voidinit()Initializes this stream.doublenextDbl()Returns the next number in this number stream.voidsetMax(double max)voidsetMin(double min)voidsetMode(double mode)StringtoString()-
Methods inherited from class jasima.core.random.continuous.DblSequence
clone, createStreamDefFromStream, getName, getRndGen, max, min, setName, setRndGen
-
-
-
-
Method Detail
-
fromMinModeMax
public static DblTriangular fromMinModeMax(double min, double mode, double max)
Factory method to create a DblStream given the distribution's mode value.- Parameters:
min- The distribution's minimum value.mode- The distribution's mode (most frequent) value.max- The distribution's maximum value.- Returns:
- A new DblTriangular object.
-
fromMinMeanMax
public static DblTriangular fromMinMeanMax(double min, double mean, double max)
Factory method to create a DblStream given the distribution's mean value.- Parameters:
min- The distribution's minimum value.mean- The distribution's mean value.max- The distribution's maximum value.- Returns:
- A new DblTriangular object.
-
init
public void init()
Description copied from class:DblSequenceInitializes this stream. This method is supposed to be called once before repeated calls toDblSequence.nextDbl()can be made.- Overrides:
initin classDblSequence
-
nextDbl
public double nextDbl()
Description copied from class:DblSequenceReturns the next number in this number stream.- Specified by:
nextDblin classDblSequence
-
getNumericalMean
public double getNumericalMean()
Description copied from class:DblSequenceReturns the arithmetic mean of the values returned byDblSequence.nextDbl().- Overrides:
getNumericalMeanin classDblSequence
-
getValueRange
public Pair<Double,Double> getValueRange()
Description copied from class:DblSequenceThis method computes the minimum and maximum support values (range of possible values) of this stream.- Overrides:
getValueRangein classDblSequence- Returns:
- A
Paircontaining the minimum and maximum support values.
-
getMin
public double getMin()
-
setMin
public void setMin(double min)
-
getMode
public double getMode()
-
setMode
public void setMode(double mode)
-
getMax
public double getMax()
-
setMax
public void setMax(double max)
-
-