umontreal.iro.lecuyer.randvar
Class TriangularGen
- java.lang.Object
-
- umontreal.iro.lecuyer.randvar.RandomVariateGen
-
- umontreal.iro.lecuyer.randvar.TriangularGen
-
public class TriangularGen extends RandomVariateGen
This class implements random variate generators for the triangular distribution. Its density iswhere a <= m <= b (see, e.g.,).f (x) = 2(x - a)/[(b - a)(m - a)] for a <= x <= m, f (x) = 2(b - x)/[(b - a)(b - m)] for m <= x <= b, f (x) = 0 elsewhere, The (non-static) nextDouble method simply calls inverseF on the distribution.
-
-
Constructor Summary
Constructors Constructor and Description TriangularGen(RandomStream s, double m)Creates a triangular random variate generator over the interval (0, 1), with parameter m, using stream s.TriangularGen(RandomStream s, double a, double b, double m)Creates a triangular random variate generator over the interval (a, b), with parameter m, using stream s.TriangularGen(RandomStream s, TriangularDist dist)Creates a new generator for the triangular distribution dist and stream s.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublegetA()Returns the value of a for this object.doublegetB()Returns the value of b for this object.doublegetM()Returns the value of m for this object.static doublenextDouble(RandomStream s, double a, double b, double m)Generates a new variate from the triangular distribution with parameters a = a, b = b and m = m and stream s, using inversion.-
Methods inherited from class umontreal.iro.lecuyer.randvar.RandomVariateGen
getDistribution, getStream, nextArrayOfDouble, nextDouble, setStream, toString
-
-
-
-
Constructor Detail
-
TriangularGen
public TriangularGen(RandomStream s, double a, double b, double m)
Creates a triangular random variate generator over the interval (a, b), with parameter m, using stream s.
-
TriangularGen
public TriangularGen(RandomStream s, double m)
Creates a triangular random variate generator over the interval (0, 1), with parameter m, using stream s.
-
TriangularGen
public TriangularGen(RandomStream s, TriangularDist dist)
Creates a new generator for the triangular distribution dist and stream s.
-
-
Method Detail
-
nextDouble
public static double nextDouble(RandomStream s, double a, double b, double m)
Generates a new variate from the triangular distribution with parameters a = a, b = b and m = m and stream s, using inversion.
-
getA
public double getA()
Returns the value of a for this object.
-
getB
public double getB()
Returns the value of b for this object.
-
getM
public double getM()
Returns the value of m for this object.
-
-
DMelt 3.0 © DataMelt by jWork.ORG