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 |
ExponentialPrng(Random theUniformPrng,
double lambda)
Construct a new exponential PRNG. |
|
Method Summary |
double |
next()
Returns the next random number. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExponentialPrng
public ExponentialPrng(Random theUniformPrng,
double lambda)
- Construct a new exponential PRNG.
- Parameters:
theUniformPrng - The underlying uniform PRNG.lambda - Mean rate λ > 0.
- Throws:
NullPointerException - (unchecked exception) Thrown if theUniformPrng is null.
IllegalArgumentException - (unchecked exception) Thrown if λ ≤ 0.
next
public double next()
- Returns the next random number.
- Specified by:
next in class DoublePrng
- Returns:
- Random number.
Copyright © 2005-2012 by Alan Kaminsky. All rights reserved. Send comments to ark@cs.rit.edu.