
public class ExponentialDistribution extends Object implements DistributionWithRandom
| Modifier and Type | Field and Description |
|---|---|
(package private) double |
rate
Rate, inverse of mean
|
(package private) Random |
rnd
Random generator.
|
| Constructor and Description |
|---|
ExponentialDistribution(double rate)
Constructor.
|
ExponentialDistribution(double rate,
Random random)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
double |
cdf(double val)
Return the cumulative density function at the given value.
|
static double |
cdf(double val,
double rate)
Cumulative density, static version
|
double |
nextRandom()
This method currently uses the naive approach of returning
-log(uniform). |
double |
pdf(double val)
Return the density of an existing value
|
static double |
pdf(double val,
double rate)
PDF, static version
|
double |
quantile(double val)
Quantile aka probit (for normal) aka inverse CDF (invcdf, cdf^-1) function.
|
static double |
quantile(double val,
double rate)
Quantile function, static version
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittoStringRandom rnd
double rate
public ExponentialDistribution(double rate)
rate - Rate parameter (1/scale)public ExponentialDistribution(double rate,
Random random)
rate - Rate parameter (1/scale)random - Random generatorpublic double pdf(double val)
Distributionpdf in interface Distributionval - existing valuepublic static double pdf(double val,
double rate)
val - Value to compute PDF atrate - Rate parameter (1/scale)public double cdf(double val)
Distributioncdf in interface Distributionval - existing valuepublic static double cdf(double val,
double rate)
val - Value to compute CDF atrate - Rate parameter (1/scale)public double quantile(double val)
Distributionquantile in interface Distributionval - Quantile to findpublic static double quantile(double val,
double rate)
val - Value to compute quantile forrate - Rate parameterpublic double nextRandom()
-log(uniform).
TODO: there are variants that do not rely on the log method and are faster.
We need to implement and evaluate these. For details: see
"Computer methods for sampling from the exponential and normal distributions"
J. H. Ahrens, U. Dieter, https://dl.acm.org/citation.cfm?id=361593nextRandom in interface DistributionWithRandom