|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsim.util.distribution.Distributions
public class Distributions
Contains methods for conveniently generating pseudo-random numbers from special distributions such as the Burr, Cauchy, Erlang, Geometric, Lambda, Laplace, Logistic, Weibull, etc.
About this class:
Example usage:
cern.jet.random.engine.MersenneTwisterFast generator;
generator = new cern.jet.random.engine.MersenneTwister(new java.util.Date());
//generator = new edu.cornell.lassp.houle.RngPack.Ranecu(new java.util.Date());
//generator = new edu.cornell.lassp.houle.RngPack.Ranmar(new java.util.Date());
//generator = new edu.cornell.lassp.houle.RngPack.Ranlux(new java.util.Date());
//generator = AbstractDistribution.makeDefaultGenerator();
for (int i=1000000; --i >=0; ) {
int cauchy = Distributions.nextCauchy(generator);
...
}
cern.jet.random.engine.MersenneTwister,
Random,
Math,
Serialized Form| Constructor Summary | |
|---|---|
protected |
Distributions()
Makes this class non instantiable, but still let's others inherit from it. |
| Method Summary | |
|---|---|
static double |
geometricPdf(int k,
double p)
Returns the probability distribution function of the discrete geometric distribution. |
static double |
nextBurr1(double r,
int nr,
MersenneTwisterFast randomGenerator)
Returns a random number from the Burr II, VII, VIII, X Distributions. |
static double |
nextBurr2(double r,
double k,
int nr,
MersenneTwisterFast randomGenerator)
Returns a random number from the Burr III, IV, V, VI, IX, XII distributions. |
static double |
nextCauchy(MersenneTwisterFast randomGenerator)
Returns a cauchy distributed random number from the standard Cauchy distribution C(0,1). |
static double |
nextErlang(double variance,
double mean,
MersenneTwisterFast randomGenerator)
Returns an erlang distributed random number with the given variance and mean. |
static int |
nextGeometric(double p,
MersenneTwisterFast randomGenerator)
Returns a discrete geometric distributed random number; Definition. |
static double |
nextLambda(double l3,
double l4,
MersenneTwisterFast randomGenerator)
Returns a lambda distributed random number with parameters l3 and l4. |
static double |
nextLaplace(MersenneTwisterFast randomGenerator)
Returns a Laplace (Double Exponential) distributed random number from the standard Laplace distribution L(0,1). |
static double |
nextLogistic(MersenneTwisterFast randomGenerator)
Returns a random number from the standard Logistic distribution Log(0,1). |
static double |
nextPowLaw(double alpha,
double cut,
MersenneTwisterFast randomGenerator)
Returns a power-law distributed random number with the given exponent and lower cutoff. |
static double |
nextTriangular(MersenneTwisterFast randomGenerator)
Returns a random number from the standard Triangular distribution in (-1,1). |
static double |
nextWeibull(double alpha,
double beta,
MersenneTwisterFast randomGenerator)
Returns a weibull distributed random number. |
static int |
nextZipfInt(double z,
MersenneTwisterFast randomGenerator)
Returns a zipfian distributed random number with the given skew. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected Distributions()
| Method Detail |
|---|
public static double geometricPdf(int k,
double p)
p(k) = p * (1-p)^k for k >= 0.
k - the argument to the probability distribution function.p - the parameter of the probability distribution function.
public static double nextBurr1(double r,
int nr,
MersenneTwisterFast randomGenerator)
Implementation: Inversion method. This is a port of burr1.c from the C-RAND / WIN-RAND library. C-RAND's implementation, in turn, is based upon
L. Devroye (1986): Non-Uniform Random Variate Generation, Springer Verlag, New York.
r - must be > 0.nr - the number of the burr distribution (e.g. 2,7,8,10).
public static double nextBurr2(double r,
double k,
int nr,
MersenneTwisterFast randomGenerator)
Implementation: Inversion method. This is a port of burr2.c from the C-RAND / WIN-RAND library. C-RAND's implementation, in turn, is based upon
L. Devroye (1986): Non-Uniform Random Variate Generation, Springer Verlag, New York.
r - must be > 0.k - must be > 0.nr - the number of the burr distribution (e.g. 3,4,5,6,9,12).public static double nextCauchy(MersenneTwisterFast randomGenerator)
p(x) = 1/ (mean*pi * (1+(x/mean)^2)).
Implementation: This is a port of cin.c from the C-RAND / WIN-RAND library.
public static double nextErlang(double variance,
double mean,
MersenneTwisterFast randomGenerator)
public static int nextGeometric(double p,
MersenneTwisterFast randomGenerator)
p(k) = p * (1-p)^k for k >= 0.
Implementation: Inversion method. This is a port of geo.c from the C-RAND / WIN-RAND library.
p - must satisfy 0 < p < 1.
public static double nextLambda(double l3,
double l4,
MersenneTwisterFast randomGenerator)
Implementation: Inversion method. This is a port of lamin.c from the C-RAND / WIN-RAND library. C-RAND's implementation, in turn, is based upon
J.S. Ramberg, B:W. Schmeiser (1974): An approximate method for generating asymmetric variables, Communications ACM 17, 78-82.
public static double nextLaplace(MersenneTwisterFast randomGenerator)
Implementation: Inversion method. This is a port of lapin.c from the C-RAND / WIN-RAND library.
public static double nextLogistic(MersenneTwisterFast randomGenerator)
Implementation: Inversion method. This is a port of login.c from the C-RAND / WIN-RAND library.
public static double nextPowLaw(double alpha,
double cut,
MersenneTwisterFast randomGenerator)
alpha - the exponentcut - the lower cutoffpublic static double nextTriangular(MersenneTwisterFast randomGenerator)
Implementation: Inversion method. This is a port of tra.c from the C-RAND / WIN-RAND library.
public static double nextWeibull(double alpha,
double beta,
MersenneTwisterFast randomGenerator)
public static int nextZipfInt(double z,
MersenneTwisterFast randomGenerator)
Algorithm from page 551 of: Devroye, Luc (1986) `Non-uniform random variate generation', Springer-Verlag: Berlin. ISBN 3-540-96305-7 (also 0-387-96305-7)
z - the skew of the distribution (must be >1.0).
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||