public class Stochastics extends Object
setSeed(Date)| Modifier and Type | Method and Description |
|---|---|
int |
getBinom(int i,
double prob)
Gets a random number from the binomial distribution.
|
int[] |
getCounts()
Gets the number of random number generations for each distribution (same order as in
getNames() since the last call of resetCounts. |
double |
getExponential(double d)
Gets a random number from the exponential distribution.
|
static Stochastics |
getInstance()
Singleton pattern method.
|
String[] |
getNames()
Gets the names of the built-in distributions.
|
double |
getNormal()
Gets a random number from the Normal distribution
|
double |
getNormal(double mean,
double stddev)
Gets a random number from the Normal distribution with given mean and stddev.
|
int |
getPoisson(double mean)
Gets a random number from the Poisson distribution.
|
long |
getSeed()
Gets the actual seed of the random number generator.
|
double |
getUnif()
Gets a random number from the uniform distribution between 0 and 1.
|
int |
getUnif(int min,
int max)
Gets a uniformly chosen random number between
min (inclusive) and max
(exclusive) |
boolean |
isCountGenerations()
Gets whether or not to count the number of random number generations
|
void |
resetCounts()
Resets the counts for each distribution to zero.
|
void |
resetSeed()
Sets the seed to the current date
|
void |
setCountGenerations(boolean countGenerations)
Sets whether or not to count the number of random number generations
|
void |
setSeed(Date seed)
Sets a new seed for the random number generator.
|
void |
setSeed(long seed)
Sets a new seed for the random number generator.
|
public static Stochastics getInstance()
public void resetSeed()
public long getSeed()
public void setSeed(long seed)
seed - the seedpublic void setSeed(Date seed)
seed - the seedpublic boolean isCountGenerations()
public void setCountGenerations(boolean countGenerations)
countGenerations - whether or not to countpublic int[] getCounts()
getNames() since the last call of resetCounts.public String[] getNames()
public void resetCounts()
public double getUnif()
Uniform.nextDouble()public double getExponential(double d)
d - meanExponential.nextDouble()public int getBinom(int i,
double prob)
i - sizeprob - probabilityBinomial.nextInt(int, double)public int getUnif(int min,
int max)
min (inclusive) and max
(exclusive)min - inclusive minimummax - exclusive maximumUniform.nextIntFromTo(int, int)public int getPoisson(double mean)
mean - meanPoisson.nextInt(double)public double getNormal()
Normal.nextDouble()public double getNormal(double mean,
double stddev)
mean - the meanstddev - the stddevNormal.nextDouble(double, double)Copyright © 2007–2021. All rights reserved.