|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjenes.MersenneTwisterFast
jenes.Random
public class Random
This class provides the random generator used by JENES.
Random extends the MersenneTwisterFast
class with some methods useful to JENES for obtaining values within a range.
Random implements the singleton design pattern, thus only one instance of Random is available and retrieved by invoking the method getInstance()
.
The random sequence is controlled by the seed. The standard seed assures that the same sequence of random values is produced by different runs. The time based seed, assures that the sequences varies run by run.
Field Summary | |
---|---|
static long |
STANDARD_SEED
The seed used as default |
Method Summary | |
---|---|
static Random |
getInstance()
Returns the Random singleton. |
boolean |
nextBoolean(double coin)
Returns a random boolean value. |
double |
nextDouble(double bound)
Returns a random double uniformly distributed within the interval [0,bound[. |
double |
nextDouble(double lowerBound,
double upperBound)
Returns a double uniformly distributed within the interval [lowerBound,upperBound[. |
int |
nextInt(int lowerBound,
int upperBound)
Returns a random integer drawn uniformly in the interval [lowerBound, upperBound[. |
void |
setStandardSeed()
Sets the stardard value as Random seed. |
void |
setTimeSeed()
Sets the current time as Random seed. |
Methods inherited from class jenes.MersenneTwisterFast |
---|
main, nextBoolean, nextByte, nextBytes, nextChar, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong, nextShort, setSeed |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long STANDARD_SEED
Method Detail |
---|
public static final Random getInstance()
public final void setTimeSeed()
public final void setStandardSeed()
public final double nextDouble(double bound)
bound
- the upper bound
public final double nextDouble(double lowerBound, double upperBound)
lowerBound
- the interval lower boundupperBound
- the interval upper bound
public final int nextInt(int lowerBound, int upperBound)
lowerBound
- the interval lower boundupperBound
- the interval upper bound
public final boolean nextBoolean(double coin)
coin
- the probability to have a true value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |