public class ExponentialDistribution extends Object
References:
(c) Apache Software Foundation (ASF), Apache commons math project
Constructor and Description |
---|
ExponentialDistribution(double mean)
Create a exponential distribution with the given mean.
|
Modifier and Type | Method and Description |
---|---|
double |
getMean()
Get the mean of this distribution.
|
static double |
nextUniform(Random rand,
double lower,
double upper)
Generates a uniformly distributed random value from the open interval
(
lower ,upper ) (i.e., endpoints excluded). |
double |
sample()
Generates a random value sampled from this distribution.
|
void |
setMean(double mean)
Sets the mean of this distribution.
|
public ExponentialDistribution(double mean)
mean
- mean of this distribution, must be greater zero.public double getMean()
public void setMean(double mean)
mean
- The new mean of this distribution.public double sample()
Algorithm Description: Uses the Algorithm SA (Ahrens) from p. 876 in: [1]: Ahrens, J. H. and Dieter, U. (1972). Computer methods for sampling from the exponential and normal distributions. Communications of the ACM, 15, 873-882.
public static double nextUniform(Random rand, double lower, double upper)
lower
,upper
) (i.e., endpoints excluded).
Algorithm Description: scales the output of Random.nextDouble(), but rejects 0 values (i.e., will generate another random double if Random.nextDouble() returns 0). This is necessary to provide a symmetric output interval (both endpoints excluded).
rand
- The random number generator.lower
- the lower bound.upper
- the upper bound.Copyright © 2012 Thomas Hillebrandt. All Rights Reserved.