All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jDisco.Random

java.lang.Object
   |
   +----java.util.Random
           |
           +----jDisco.Random

public class Random
extends java.util.Random
A class for random drawing.


Constructor Index

 o Random()
This constructor creates a Random object with the current time as its seed value.
 o Random(long)
This constructor creates a Random object with the given seed value.

Method Index

 o beta(double, double)
Returns a double drawn from the beta distribution.
 o binomial(int, double)
Returns a double drawn from the binomial distribution.
 o cauchy(double, double)
Returns a double drawn from the Cauchy distribution.
 o chiSquare(int)
Returns a double drawn from the Chi-Square distribution.
 o discrete(double[])
Returns an integer from a given discrete distribution.
 o draw(double)
Returns true or false with a given probability.
 o erlang(double, double)
Returns a double drawn from the Erlang distribution.
 o exp(double)
Returns a double drawn from the exponential distribution.
 o fDist(int, int)
Returns a double drawn from the F-distribution.
 o gamma(double, double)
Returns a double drawn from the gamma distribution.
 o geometric(double)
Returns an int drawn from the geometric distribution.
 o histd(double[])
Returns a random integer drawn from a distribution defined by a histogram.
 o hyperExponential(double, double)
Returns a double drawn from the Hyper-Exponential distribution.
 o hyperGeomtric(int, int, double)
Returns an int drawn from the Hyper-Geometric distribution.
 o linear(double[], double[])
Returns a double from a distribution function f.
 o logNormal(double, double)
Returns a double drawn from the LogNormal distribution.
 o negativeBinomial(double, int)
Returns a double drawn from the negative binomial distribution.
 o negexp(double)
Returns a double drawn from the negative exponential distribution.
 o normal(double, double)
Returns a normally distributed double.
 o poisson(double)
Returns an integer drawn from the Poisson distribution.
 o randInt(int, int)
Returns an integer in a given range with uniform probability.
 o student(int)
Returns a double drawn from Student's t distribution.
 o triangular(double, double)
Returns a double drawn from the triangular distribution.
 o uniform(double, double)
Returns a double in a given range with uniform probability.
 o weibul(double, double)
Returns a double drawn from the Weibul distribution.

Constructors

 o Random
 public Random()
This constructor creates a Random object with the current time as its seed value.

 o Random
 public Random(long seed)
This constructor creates a Random object with the given seed value.

Methods

 o draw
 public final boolean draw(double a)
Returns true or false with a given probability.

Parameters:
a - the propability.
Returns:
true, with probability a, false with probability 1-a.
If a >= 1, true is always returned.
If a <= 0, false is always returned.
 o randInt
 public final int randInt(int a,
                          int b)
Returns an integer in a given range with uniform probability.

Parameters:
a - the minimum value.
b - the maximum value.
Returns:
one of the integers a, a+1, ..., b-1, b with equal probability.
Throws: DiscoException
if b < a.
 o uniform
 public final double uniform(double a,
                             double b)
Returns a double in a given range with uniform probability.

Parameters:
a - the minimum value.
b - the maximum value.
Returns:
a double in the range from a to b, not including b, with uniform probability.
Throws: DiscoException
if b <= a.
 o normal
 public final double normal(double a,
                            double b)
Returns a normally distributed double.

Parameters:
a - the mean.
b - the standard deviation.
Returns:
a normally distributed double with mean a and standard deviation b.
 o negexp
 public final double negexp(double a)
Returns a double drawn from the negative exponential distribution.

Parameters:
a - the reciprocal value of the mean.
Returns:
a double drawn from the negative exponential distribution with mean 1/a.
Throws: DiscoException
if a <= 0.
 o poisson
 public final int poisson(double a)
Returns an integer drawn from the Poisson distribution.

Parameters:
a - the mean.
Returns:
an integer drawn from the Poisson distribution with mean a.
 o erlang
 public final double erlang(double a,
                            double b)
Returns a double drawn from the Erlang distribution.

Parameters:
a - the reciprocal value of the mean.
Returns:
a double drawn from the Erlang distribution with mean 1/a.
Throws: DiscoException
if a <= 0 or b <= 0.
 o discrete
 public final int discrete(double a[])
Returns an integer from a given discrete distribution.

The array a holds values corresponding to a step function, rising from 0 to 1. The array, augmented by the element 1 to the right, is interpreted as a step function of the subscript, defining a discrete (cumulative) distribution function. The method returns smallest index i such that a[i] > r, where r is a uniformly distributed random number in the interval [0;1], and a[a.length] = 1.

Parameters:
a - the distribution table.
Returns:
a double drawn from the discrete (cumulative) distribution defined by a.
 o linear
 public final double linear(double a[],
                            double b[])
Returns a double from a distribution function f.

Parameters:
a - the f(p) values.
b - the p-values as well as b.
Returns:
a double drawn from a discrete (cumulative) distribution function f. The value is found by a linear interpolation in a table defined by a and b, such that a[i] = f(b[i]).
Throws: DiscoException
if either a[0] != 0, a[a.length-1] != 1 or a.length != b.length.
 o histd
 public final int histd(double a[])
Returns a random integer drawn from a distribution defined by a histogram.

The parameter a is interpreted as a histogram defining the relative frequencies of the values.

Parameters:
a - the histogram.
Returns:
an integer in the range [0;n-1].
 o gamma
 public final double gamma(double alpha,
                           double beta)
Returns a double drawn from the gamma distribution.

Parameters:
alpha - the shape.
beta - the scale.
Returns:
a double drawn from the gamma distribution with mean alpha * beta and variance alpha * beta2.
Throws: DiscoException
if alpha <= 0 or beta <= 0.
 o beta
 public final double beta(double alpha,
                          double beta)
Returns a double drawn from the beta distribution.

Parameters:
alpha - shape parameter for gamma1.
beta - shape parameter for gamma2.
Returns:
a double drawn from the beta distribution: gamma1 / (gamma1 + gamma2).
Throws: DiscoException
if alpha < 0 or beta < 0.
 o binomial
 public final double binomial(int n,
                              double p)
Returns a double drawn from the binomial distribution.

Parameters:
n - number of trials.
p - propability of success.
Returns:
a double drawn from the binomial distribution.
 o cauchy
 public final double cauchy(double a,
                            double b)
Returns a double drawn from the Cauchy distribution.

Parameters:
a - the mea.n
b - the standard deviation.
Returns:
a double drawn from the Cauchy distribution with mean a and standard deviation b.
 o chiSquare
 public final double chiSquare(int n)
Returns a double drawn from the Chi-Square distribution.

Parameters:
n - The degrees of freedom.
Returns:
a double drawn from the Chi-Square distribution with n degrees of freedom.
 o exp
 public final double exp(double a)
Returns a double drawn from the exponential distribution.

Parameters:
a - the mean.
Returns:
a double drawn from the exponential distribution with mean a.
 o fDist
 public final double fDist(int m,
                           int n)
Returns a double drawn from the F-distribution.

Parameters:
m - degrees of freedom for numerator Chi-Square.
n - degrees of freedom for denominator Chi-Square.
Returns:
a double drawn from the F-distribution.
 o geometric
 public final int geometric(double p)
Returns an int drawn from the geometric distribution.

Parameters:
p - the event propability.
Returns:
a int drawn from the geometric distribution.
 o hyperExponential
 public final double hyperExponential(double a,
                                      double b)
Returns a double drawn from the Hyper-Exponential distribution.

Parameters:
a - the mean.
b - the standard deviation.
Returns:
a double drawn from the Hyper-Exponential distribution with mean a and standard deviation b.
 o hyperGeomtric
 public final double hyperGeomtric(int m,
                                   int n,
                                   double p)
Returns an int drawn from the Hyper-Geometric distribution.

Parameters:
m - size of population.
n - number of items to be drawn.
p - propability of success.
Returns:
an int drawn from the Hyper-Geometric distribution.
 o logNormal
 public final double logNormal(double a,
                               double b)
Returns a double drawn from the LogNormal distribution.

Parameters:
a - the mean.
b - the standard deviation.
Returns:
a double drawn from the LogNoram distribution with mean a and standard deviation b.
 o negativeBinomial
 public final double negativeBinomial(double p,
                                      int n)
Returns a double drawn from the negative binomial distribution.

Parameters:
p - propability of success.
n - number of successes.
Returns:
a double drawn from the negative binomial distribution.
 o student
 public final double student(int n)
Returns a double drawn from Student's t distribution.

Parameters:
n - degrees of freedom.
Returns:
a double drawn from Student's t distribution.
 o triangular
 public final double triangular(double min,
                                double max)
Returns a double drawn from the triangular distribution.

Parameters:
min - the minimum value.
max - the maximum value.
Returns:
a double drawn from the triangular distribution.
 o weibul
 public final double weibul(double scale,
                            double shape)
Returns a double drawn from the Weibul distribution.

Parameters:
scale - the scale.
shape - the shap.e
Returns:
a double drawn from the Weibul distribution.

All Packages  Class Hierarchy  This Package  Previous  Next  Index