|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.utils.random.RandomNumberGenerator
public class RandomNumberGenerator
Class for generating random numbers of many different distributions.
This class was written by Sundar Dorai-Raj and was downloaded from http://www.stat.vt.edu/~sundar/java/. Only a few modifications were made
by Jens Keilwagen eliminating some not used variables and making the comments
visible for javadoc.
RandomNumberGenerator.java Copyright (c) 2000 by Sundar Dorai-Raj
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version, provided that any use properly credits the author.
This program 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 General Public License for more details
at http://www.gnu.org
Reference. M. Matsumoto and T. Nishimura, "Mersenne Twister: A
623-Dimensionally Equidistributed Uniform Pseudo-Random Number Generator",
ACM Transactions on Modeling and Computer Simulation, Vol. 8, No. 1, January
1998, pp 3--30.
Constructor Summary | |
---|---|
RandomNumberGenerator()
|
|
RandomNumberGenerator(long seed)
|
Method Summary | |
---|---|
protected int |
next(int bits)
|
double |
nextBeta(double alpha,
double beta)
generates a random number from Beta(alpha,beta) (E(X)=a/(a+b) ; Var(X)=ab/[(a+b+1)(a+b)^2]) |
boolean |
nextBoolean()
generates a random boolean variable |
boolean |
nextBoolean(double p)
generates true with probability p |
double |
nextChiSq()
generates a random number from ChiSq(1) (E(X)=1 ; Var(X)=2) |
double |
nextChiSq(int df)
generates a random number from ChiSq(df) (E(X)=df ; Var(X)=2*df) |
double |
nextChiSq(int df,
double lambda)
generates a random number from shifted-ChiSq(df) (E(X)=df+lambda ; Var(X)=2*df) |
double |
nextExp()
generates a random number from Exp(1) (E(X)=1 ; Var(X)=1) |
double |
nextExp(double beta)
generates a random number from Exp(beta) (E(X)=beta ; Var(X)=beta^2) |
double |
nextExp(double beta,
double lambda)
generates a random number from shifted-Exp(beta) (E(X)=beta+lambda ; Var(X)=beta^2) |
double |
nextGamma()
generates a random number from Gamma(1,1) (E(X)=1 ; Var(X)=1) |
double |
nextGamma(double alpha,
double beta)
generates a random number from Gamma(alpha,beta) (E(X)=alpha*beta ; Var(X)=alpha*beta^2) |
double |
nextGamma(double alpha,
double beta,
double lambda)
generates a random number from shifted-Gamma(alpha,beta) (E(X)=alpha*beta+lambda ; Var(X)=alpha*beta^2) |
double |
nextGammaLog(double alpha,
double beta)
|
double |
nextGaussian()
generates a random number from N(0,1) (E(X)=0 ; Var(X)=1) |
double |
nextGaussian(double m,
double s2)
generates a random number from N(m,s2) (E(X)=m ; Var(X)=s2) |
int |
nextInt()
generates an integer between 0 and 2^32 |
int |
nextInt(int n)
generates an integer between 0 and n-1 (inclusive) |
int |
nextPoisson()
generates a random number from Poisson(1) (E(X)=1 ; Var(X)=1) |
int |
nextPoisson(double lambda)
generates a random number from Poisson(lambda) (E(X)=lambda ; Var(X)=lambda) |
double |
nextUniform()
generates a random number from U(0,1) (E(X)=1/2 ; Var(X)=1/12) |
double |
nextUniform(double a,
double b)
generates a random number from U(a,b) (E(X)=(b-a)/2 ; Var(X)=(b-a)^2/12) |
protected void |
setSeed(long seed)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomNumberGenerator()
public RandomNumberGenerator(long seed)
Method Detail |
---|
protected void setSeed(long seed)
protected int next(int bits)
public int nextInt()
public int nextInt(int n)
public int nextPoisson(double lambda)
public int nextPoisson()
public boolean nextBoolean()
public boolean nextBoolean(double p)
public double nextUniform()
public double nextUniform(double a, double b)
public double nextGaussian()
public double nextGaussian(double m, double s2)
public double nextGamma()
public double nextGamma(double alpha, double beta)
public double nextGamma(double alpha, double beta, double lambda)
public double nextGammaLog(double alpha, double beta)
public double nextExp()
public double nextExp(double beta)
public double nextExp(double beta, double lambda)
public double nextChiSq()
public double nextChiSq(int df)
public double nextChiSq(int df, double lambda)
public double nextBeta(double alpha, double beta)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |