, and not as
the right hand side of an assignment. Assigning a variable in this way
can lead to unpredictable results when setting the random seed.
All the distributions in Random are from the colt library. The instance
variable name is the same as the corresponding colt object with the first
character in lower case. For example, the Zeta distribution is called zeta.
See the colt library documentation in repast/docs/colt
for more
information about these distributions.
The next* methods can be used as is, without creating a distribution
before hand. For example,
double s = Random.nextCauchy();
Random also allows you to set and get the random seed as well as the
random number generator associated with that seed. Setting a new seed with
setSeed
will create a new random number generator and
invalidate any previously created distributions. If you wish to use
a distribution after the seed has been set, you must create it as
described above. All of the distributions contained by Random will use the
same generator - a MersenneTwister. Consequently, once the seed is set
all the distributions will use the same generator, same random
number stream and repeatable randomness can be easily achieved.
Note that Random creates a default random number generator using the
current timestamp as the seed. If you do not explicitly set your own seed,
the distributions created via the create* calls will use this default
generator.
- See Also:
- "The RePast random how to in repast/docs/how_to/random.html",
"The colt library docs in repast/docs/colt/index.html"
Method Summary |
static void |
createBeta(double alpha,
double beta)
|
static void |
createBinomial(int n,
double p)
|
static void |
createBreitWigner(double mean,
double gamma,
double cut)
|
static void |
createBreitWignerMeanSquareState(double mean,
double gamma,
double cut)
|
static void |
createChiSquare(double freedom)
|
static void |
createEmpirical(double[] pdf,
int interpolationType)
|
static void |
createEmpiricalWalker(double[] pdf,
int interpolationType)
|
static void |
createExponential(double lambda)
|
static void |
createExponentialPower(double tau)
|
static void |
createGamma(double alpha,
double lambda)
|
static void |
createHyperbolic(double alpha,
double beta)
|
static void |
createHyperGeometric(int N,
int s,
int n)
|
static void |
createLogarithmic(double p)
|
static void |
createNegativeBinomial(int n,
double p)
|
static void |
createNormal(double mean,
double standardDeviation)
|
static void |
createPoisson(double mean)
|
static void |
createPoissonSlow(double mean)
|
static void |
createStudentT(double freedom)
|
static void |
createUniform()
|
static void |
createUniform(double min,
double max)
|
static void |
createVonMises(double freedom)
|
static void |
createZeta(double ro,
double pk)
|
static cern.jet.random.engine.RandomEngine |
generateNewSeed()
Generates a new random number generator using the
the current timestamp as a the seed. |
static double |
geometricPdf(int k,
double p)
|
static cern.jet.random.engine.RandomEngine |
getGenerator()
Gets the current random number generator. |
static cern.jet.random.engine.RandomEngine |
getGenerator(long seed)
Creates a new random number generator with the specified
seed and returns this new generator. |
static long |
getSeed()
Gets the current randon number generator seed. |
static double |
nextBurr1(double r,
int nr)
|
static double |
nextBurr2(double r,
double k,
int nr)
|
static double |
nextCauchy()
|
static double |
nextErlang(double variance,
double mean)
|
static int |
nextGeometric(double p)
|
static double |
nextLambda(double l3,
double l4)
|
static double |
nextLaplace()
|
static double |
nextLogistic()
|
static double |
nextPowLaw(double alpha,
double cut)
|
static double |
nextTriangular()
|
static double |
nextWeibull(double alpha,
double beta)
|
static int |
nextZipfInt(double z)
|
static void |
setSeed(long seed)
Creates a new random number generator with the specified
seed. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LINEAR_INTERPOLATION
public static final int LINEAR_INTERPOLATION
- See Also:
- Constant Field Values
NO_INTERPOLATIONN
public static final int NO_INTERPOLATIONN
- See Also:
- Constant Field Values
beta
public static cern.jet.random.Beta beta
binomial
public static cern.jet.random.Binomial binomial
breitWigner
public static cern.jet.random.BreitWigner breitWigner
breitWignerMeanSquare
public static cern.jet.random.BreitWignerMeanSquare breitWignerMeanSquare
chiSquare
public static cern.jet.random.ChiSquare chiSquare
empirical
public static cern.jet.random.Empirical empirical
empiricalWalker
public static cern.jet.random.EmpiricalWalker empiricalWalker
exponential
public static cern.jet.random.Exponential exponential
exponentialPower
public static cern.jet.random.ExponentialPower exponentialPower
gamma
public static cern.jet.random.Gamma gamma
hyperbolic
public static cern.jet.random.Hyperbolic hyperbolic
hyperGeometric
public static cern.jet.random.HyperGeometric hyperGeometric
logarithmic
public static cern.jet.random.Logarithmic logarithmic
negativeBinomial
public static cern.jet.random.NegativeBinomial negativeBinomial
normal
public static cern.jet.random.Normal normal
poisson
public static cern.jet.random.Poisson poisson
poissonSlow
public static cern.jet.random.PoissonSlow poissonSlow
studentT
public static cern.jet.random.StudentT studentT
uniform
public static cern.jet.random.Uniform uniform
vonMises
public static cern.jet.random.VonMises vonMises
zeta
public static cern.jet.random.Zeta zeta
Random
public Random()
geometricPdf
public static double geometricPdf(int k,
double p)
nextBurr1
public static double nextBurr1(double r,
int nr)
nextBurr2
public static double nextBurr2(double r,
double k,
int nr)
nextCauchy
public static double nextCauchy()
nextErlang
public static double nextErlang(double variance,
double mean)
nextGeometric
public static int nextGeometric(double p)
nextLambda
public static double nextLambda(double l3,
double l4)
nextLaplace
public static double nextLaplace()
nextLogistic
public static double nextLogistic()
nextPowLaw
public static double nextPowLaw(double alpha,
double cut)
nextTriangular
public static double nextTriangular()
nextWeibull
public static double nextWeibull(double alpha,
double beta)
nextZipfInt
public static int nextZipfInt(double z)
createZeta
public static void createZeta(double ro,
double pk)
createVonMises
public static void createVonMises(double freedom)
createUniform
public static void createUniform(double min,
double max)
createUniform
public static void createUniform()
createStudentT
public static void createStudentT(double freedom)
createPoissonSlow
public static void createPoissonSlow(double mean)
createPoisson
public static void createPoisson(double mean)
createNormal
public static void createNormal(double mean,
double standardDeviation)
createNegativeBinomial
public static void createNegativeBinomial(int n,
double p)
createLogarithmic
public static void createLogarithmic(double p)
createHyperGeometric
public static void createHyperGeometric(int N,
int s,
int n)
createHyperbolic
public static void createHyperbolic(double alpha,
double beta)
createGamma
public static void createGamma(double alpha,
double lambda)
createExponentialPower
public static void createExponentialPower(double tau)
createExponential
public static void createExponential(double lambda)
createEmpiricalWalker
public static void createEmpiricalWalker(double[] pdf,
int interpolationType)
createEmpirical
public static void createEmpirical(double[] pdf,
int interpolationType)
createChiSquare
public static void createChiSquare(double freedom)
createBreitWignerMeanSquareState
public static void createBreitWignerMeanSquareState(double mean,
double gamma,
double cut)
createBreitWigner
public static void createBreitWigner(double mean,
double gamma,
double cut)
createBinomial
public static void createBinomial(int n,
double p)
createBeta
public static void createBeta(double alpha,
double beta)
generateNewSeed
public static cern.jet.random.engine.RandomEngine generateNewSeed()
- Generates a new random number generator using the
the current timestamp as a the seed.
This will invalidate any previously created
distributions.
getGenerator
public static cern.jet.random.engine.RandomEngine getGenerator()
- Gets the current random number generator.
getGenerator
public static cern.jet.random.engine.RandomEngine getGenerator(long seed)
- Creates a new random number generator with the specified
seed and returns this new generator.
This will invalidate any previously created
distributions.
- Parameters:
seed
- the new generator seed
- Returns:
- the new generator
setSeed
public static void setSeed(long seed)
- Creates a new random number generator with the specified
seed. This will invalidate any previously created
distributions.
- Parameters:
seed
- the seed for the new generator
getSeed
public static long getSeed()
- Gets the current randon number generator seed.