edu.rit.numeric
Class ExponentialPrng
- java.lang.Object
-
- edu.rit.numeric.DoublePrng
-
- edu.rit.numeric.ExponentialPrng
-
public class ExponentialPrng extends DoublePrng
Class ExponentialPrng provides a pseudorandom number generator (PRNG) that generates random numbers with an exponential distribution. The probability density function is
f(x) = λe−λx, x ≥ 0
f(x) = 0, otherwise
The distribution's mean is 1/λ and its standard deviation is 1/λ2.An exponential distribution is often used to model arrivals or departures in a discrete event simulation. The mean arrival or departure rate is λ; the mean interarrival or interdeparture time is 1/λ.
Every call of the next() method results in one call of the underlying uniform PRNG's nextDouble() method.
-
-
Constructor Summary
Constructors Constructor and Description ExponentialPrng(Random theUniformPrng, double lambda)Construct a new exponential PRNG.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublenext()Returns the next random number.
-
-
-
Constructor Detail
-
ExponentialPrng
public ExponentialPrng(Random theUniformPrng, double lambda)
Construct a new exponential PRNG.- Parameters:
theUniformPrng- The underlying uniform PRNG.lambda- Mean rate λ > 0.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if theUniformPrng is null.java.lang.IllegalArgumentException- (unchecked exception) Thrown if λ ≤ 0.
-
-
Method Detail
-
next
public double next()
Returns the next random number.- Specified by:
nextin classDoublePrng- Returns:
- Random number.
-
-
DMelt 3.0 © DataMelt by jWork.ORG