physis.core.random
Class Randomness
java.lang.Object
|
+--physis.core.random.Randomness
- Direct Known Subclasses:
- JavaUtilRandom, MersenneTwister
- public abstract class Randomness
- extends java.lang.Object
class Randomness - a very plain boring name for basically
a random number generator abstraction layer. Which I use
for all of my evolutionary computation work.
The past and the future are entirely contained in the present.
-Ivar Ekeland, Mathematics and the Unexpected. 1988
Wed 30-May-2001 23:34 bush
{Ghost Machine Industries}
|
Method Summary |
abstract int |
next(int bits)
To extend this class, all you need to do is implement this method! |
boolean |
nextBoolean()
|
boolean |
nextBoolean(double probability)
This generates a coin flip with a probability probability
of returning true, else returning false. |
byte |
nextByte()
|
void |
nextBytes(byte[] bytes)
A bug fix for all versions of the JDK. |
double |
nextDouble()
|
float |
nextFloat()
|
int |
nextInt()
Returns a 32 bit uniformly distributed random number in the closed interval
[Integer.MIN_VALUE,Integer.MAX_VALUE]
(including Integer.MIN_VALUE and Integer.MAX_VALUE). |
int |
nextInt(int n)
|
long |
nextLong()
Returns a 64 bit uniformly distributed random number
in the closed interval [Long.MIN_VALUE,Long.MAX_VALUE]
(including Long.MIN_VALUE and Long.MAX_VALUE). |
double |
raw()
Returns a 32 bit uniformly distributed random
number in the open unit interval (0.0,1.0)
(excluding 0.0 and 1.0). |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
Randomness
public Randomness(long seed)
nextInt
public final int nextInt()
- Returns a 32 bit uniformly distributed random number in the closed interval
[Integer.MIN_VALUE,Integer.MAX_VALUE]
(including Integer.MIN_VALUE and Integer.MAX_VALUE).
nextInt
public final int nextInt(int n)
next
public abstract int next(int bits)
- To extend this class, all you need to do is implement this method!
nextLong
public final long nextLong()
- Returns a 64 bit uniformly distributed random number
in the closed interval [Long.MIN_VALUE,Long.MAX_VALUE]
(including Long.MIN_VALUE and Long.MAX_VALUE).
nextDouble
public final double nextDouble()
nextFloat
public final float nextFloat()
nextBytes
public final void nextBytes(byte[] bytes)
- A bug fix for all versions of the JDK. The JDK appears to
use all four bytes in an integer as independent byte values!
Totally wrong.
nextByte
public final byte nextByte()
nextBoolean
public final boolean nextBoolean()
nextBoolean
public final boolean nextBoolean(double probability)
- This generates a coin flip with a probability probability
of returning true, else returning false. probability must
be between 0.0 and 1.0, inclusive.
raw
public final double raw()
- Returns a 32 bit uniformly distributed random
number in the open unit interval
(0.0,1.0)
(excluding 0.0 and 1.0).