|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.griphyn.cPlanner.common.PegRandom
public class PegRandom
A Helper class that returns the Random values using java.util.Random class. It is a singleton instance, and all functions in Pegasus call it to get the random value. The singleton ensures that the number returned is random as compared to previous values. If this is not used and one ends up doing a new Random(), all the calls effectively end up setting the same seed value, nad by extension one gets the same value. Using just one Random object we hope to bypass the problem.
Copyright: Copyright (c) 2002
Company: USC/ISI
| Field Summary | |
|---|---|
private static Random |
mRandom
The object containing the instance of the java.util.Random class. |
| Constructor Summary | |
|---|---|
PegRandom()
|
|
| Method Summary | |
|---|---|
static int |
getInteger(int upperIndex)
This calls the next double function and returns an integer between the 0 and upper index. |
static int |
getInteger(int lowerIndex,
int upperIndex)
This calls the next double function and returns an integer between the lower index and upper index. |
static double |
nextDouble()
Returns a double value between 0.0 and 1.0. |
static double |
nextGaussian()
Returns a normally distributed (gaussian) random variable between 0.0 and 1.0. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static Random mRandom
| Constructor Detail |
|---|
public PegRandom()
| Method Detail |
|---|
public static double nextDouble()
public static double nextGaussian()
public static int getInteger(int upperIndex)
public static int getInteger(int lowerIndex,
int upperIndex)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||