|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjas.random.RandomGenerator
public class RandomGenerator
This class is a repository for random number generators. It is able to generate random numbers from many distribution through static methods.
All generators are synchronized with the same random seed. It guarantees the repetibility of experiments.
The first the time is asked a number from a particular distribution RandomGenerator creates a new instance and reuse it at the next calls.
Title: JAS
Description: Java Agent-based Simulation library
Copyright (C) 2002 Michele Sonnessa
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
Constructor Summary | |
---|---|
RandomGenerator()
Default constructor. |
|
RandomGenerator(int seed)
This constructor creates a MersenneTwister raw generator with the given seed. |
Method Summary | |
---|---|
double |
getBeta(double alpha,
double beta)
Generate a random sample from the Beta distribution with given parameters. |
int |
getBinomial(int n,
double p)
Generate a random sample from the Binomial distribution with given parameters. |
double |
getBreitWigner(double mean,
double gamma,
double cut)
Generate a random sample from the BreitWigner distribution with given parameters. |
double |
getBreitWignerMeanSquare(double mean,
double gamma,
double cut)
Generate a random sample from the BreitWignerMeanSquare distribution with given parameters. |
double |
getBurr1(double r,
int nr)
Generate a random sample from the Burr1 distribution with given parameters. |
double |
getBurr2(double r,
double k,
int nr)
Generate a random sample from the Burr2 distribution with given parameters. |
double |
getCauchy()
Generate a random sample from the Cauchy distribution with given parameters. |
double |
getChiSquare(double freedom)
Generate a random sample from the ChiSquare distribution with given parameters. |
double |
getDblFromTo(double from,
double to)
Generate a random double within the exclusive interval (from, to). |
double |
getErlang(double variance,
double mean)
Generate a random sample from the Erlang distribution with given parameters. |
double |
getExponential(double lambda)
Generate a random sample from the Exponential distribution with given parameters. |
double |
getExponentialPower(double tau)
Generate a random sample from the ExponentialPower distribution with given parameters. |
float |
getFloatFromTo(float from,
float to)
Generate a random float within the exclusive interval (from, to). |
double |
getGamma(double alpha,
double lambda)
Generate a random sample from the Gamma distribution with given parameters. |
int |
getGeometric(double p)
Generate a random sample from the Geometric distribution with given parameters. |
double |
getHyperbolic(double alpha,
double beta)
Generate a random sample from the Hyperbolic distribution with given parameters. |
int |
getHyperGeometric(int N,
int s,
int n)
Generate a random sample from the HyperGeometric distribution with given parameters. |
int |
getIntFromTo(int from,
int to)
Generate a random integer within the inclusive interval [from, to]. |
double |
getLambda(double l3,
double l4)
Generate a random sample from the Lambda distribution with given parameters. |
double |
getLaplace()
Generate a random sample from the Laplace distribution with given parameters. |
double |
getLogarithmic(double p)
Generate a random sample from the Logarithmic distribution with given parameters. |
double |
getLogistic()
Generate a random sample from the Logistic distribution with given parameters. |
long |
getLongFromTo(long from,
long to)
Generate a random long within the inclusive interval [from, to]. |
int |
getNegativeBinomial(int n,
double p)
Generate a random sample from the NegativeBinomial distribution with given parameters. |
double |
getNormal(double mean,
double standardDeviation)
Generate a random sample from the Normal distribution with given parameters. |
int |
getPoisson(double mean)
Generate a random sample from the Poisson distribution with given parameters. |
double |
getPowLaw(double alpha,
double cut)
Generate a random sample from the PowLaw distribution with given parameters. |
cern.jet.random.engine.RandomEngine |
getRandomEngine()
Return the current raw generator. |
int |
getSeed()
Change the seed for the current raw generator. |
double |
getTriangular()
Generate a random sample from the Triangular distribution with given parameters. |
double |
getVonMises(double freedom)
Generate a random sample from the VonMises distribution with given parameters. |
double |
getWeibull(double alpha,
double beta)
Generate a random sample from the Weibull distribution with given parameters. |
int |
getZeta(double ro,
double pk)
Generate a random sample from the Zeta distribution with given parameters. |
int |
getZipfInt(double z)
Generate a random sample from the ZipfInt distribution with given parameters. |
void |
setSeed(int newSeed)
Change the seed for the current raw generator. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomGenerator()
public RandomGenerator(int seed)
seed
- The seed for random numbers.Method Detail |
---|
public double getBeta(double alpha, double beta)
alpha
- A well known distribution parameters.beta
- A well known distribution parameters.
public int getBinomial(int n, double p)
n
- A well known distribution parameters.p
- A well known distribution parameters.
public double getBreitWigner(double mean, double gamma, double cut)
mean
- A well known distribution parameters.gamma
- A well known distribution parameters.cut
- A well known distribution parameters.
public double getBreitWignerMeanSquare(double mean, double gamma, double cut)
mean
- A well known distribution parameters.gamma
- A well known distribution parameters.cut
- A well known distribution parameters.
public double getBurr1(double r, int nr)
r
- A well known distribution parameters.nr
- A well known distribution parameters.
public double getBurr2(double r, double k, int nr)
r
- A well known distribution parameters.k
- A well known distribution parameters.nr
- A well known distribution parameters.
public double getCauchy()
public double getChiSquare(double freedom)
freedom
- A well known distribution parameters.
public double getDblFromTo(double from, double to)
from
- The lower exclusive bound.to
- The upper exclusive bound.
public double getErlang(double variance, double mean)
variance
- A well known distribution parameters.mean
- A well known distribution parameters.
public double getExponential(double lambda)
lambda
- A well known distribution parameters.
public double getExponentialPower(double tau)
tau
- A well known distribution parameters.
public float getFloatFromTo(float from, float to)
from
- The lower exclusive bound.to
- The upper exclusive bound.
public double getGamma(double alpha, double lambda)
alpha
- A well known distribution parameters.lambda
- A well known distribution parameters.
public int getGeometric(double p)
p
- A well known distribution parameters.
public double getHyperbolic(double alpha, double beta)
alpha
- A well known distribution parameters.beta
- A well known distribution parameters.
public int getHyperGeometric(int N, int s, int n)
N
- A well known distribution parameters.s
- A well known distribution parameters.n
- A well known distribution parameters.
public int getIntFromTo(int from, int to)
from
- The lower inclusive bound.to
- The upper inclusive bound.
public double getLambda(double l3, double l4)
l3
- A well known distribution parameters.l4
- A well known distribution parameters.
public double getLaplace()
public double getLogarithmic(double p)
p
- A well known distribution parameters.
public double getLogistic()
public long getLongFromTo(long from, long to)
from
- The lower inclusive bound.to
- The upper inclusive bound.
public int getNegativeBinomial(int n, double p)
n
- A well known distribution parameters.p
- A well known distribution parameters.
public double getNormal(double mean, double standardDeviation)
mean
- A well known distribution parameters.standardDeviation
- A well known distribution parameters.
public int getPoisson(double mean)
mean
- A well known distribution parameters.
public double getPowLaw(double alpha, double cut)
alpha
- A well known distribution parameters.cut
- A well known distribution parameters.
public cern.jet.random.engine.RandomEngine getRandomEngine()
public int getSeed()
newSeed
- The new seed number.public double getTriangular()
public double getVonMises(double freedom)
freedom
- A well known distribution parameters.
public double getWeibull(double alpha, double beta)
alpha
- A well known distribution parameters.beta
- A well known distribution parameters.
public int getZeta(double ro, double pk)
ro
- A well known distribution parameters.pk
- A well known distribution parameters.
public int getZipfInt(double z)
z
- A well known distribution parameters.
public void setSeed(int newSeed)
newSeed
- The new seed number.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |