|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectes.udc.gii.common.eaf.util.EAFRandom
public class EAFRandom
Random number generator.
Field Summary | |
---|---|
private static long |
_seed
Random seed. |
private static boolean |
initialized
States if this class is initialized |
private static java.util.Random |
rand
Random generator. |
Constructor Summary | |
---|---|
private |
EAFRandom()
Class constructor: Singleton class. |
Method Summary | |
---|---|
static long |
getSeed()
The seed currently used by the random number generator. |
static void |
init()
Initializes this random number generator. |
static void |
init(long seed)
Initializes this random number generator. |
static boolean |
isInitialized()
Test for initialization. |
static boolean |
nextBoolean()
Returns the next pseudorandom, uniformly distributed boolean value from this random number generator's sequence. |
static void |
nextBytes(byte[] bytes)
Generates random bytes and places them into a user-supplied byte array. |
static double |
nextDouble()
Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence. |
static float |
nextFloat()
Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence. |
static double |
nextGaussian()
Returns the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence. |
static int |
nextInt()
Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence. |
static int |
nextInt(int n)
Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence. |
static long |
nextLong()
Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static long _seed
private static java.util.Random rand
private static boolean initialized
Constructor Detail |
---|
private EAFRandom()
Method Detail |
---|
public static void init()
This method must be called before generating any random number.
public static void init(long seed)
This method must be called before generating any random number.
seed
- The seed for the random number generator.public static boolean nextBoolean()
java.lang.NullPointerException
- if this class is not initialized.public static void nextBytes(byte[] bytes)
bytes
- The byte array to fill with random bytes.
java.lang.NullPointerException
- If this class is not initialized or if the
byte array is null.public static double nextDouble()
java.lang.NullPointerException
- if this class is not initialized.public static float nextFloat()
java.lang.NullPointerException
- if this class is not initialized.public static double nextGaussian()
java.lang.NullPointerException
- if this class is not initialized.public static int nextInt()
java.lang.NullPointerException
- if this class is not initialized.public static int nextInt(int n)
n
- The bound on the random number to be returned. Must be positive.
java.lang.NullPointerException
- if this class is not initialized.
java.lang.IllegalArgumentException
- if n is not positive.public static long nextLong()
java.lang.NullPointerException
- if this class is not initialized.public static boolean isInitialized()
true
if the generator is initialized. false
otherwise.public static long getSeed()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |