Package edu.isi.pegasus.planner.common
Class PegRandom
- java.lang.Object
-
- edu.isi.pegasus.planner.common.PegRandom
-
public class PegRandom extends java.lang.Object
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
- Version:
- $Revision$
- Author:
- Gaurang Mehta, Karan Vahi
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Random
mRandom
The object containing the instance of the java.util.Random class.
-
Constructor Summary
Constructors Constructor Description PegRandom()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Method Detail
-
nextDouble
public static double nextDouble()
Returns a double value between 0.0 and 1.0.
-
nextGaussian
public static double nextGaussian()
Returns a normally distributed (gaussian) random variable between 0.0 and 1.0.
-
getInteger
public static int getInteger(int upperIndex)
This calls the next double function and returns an integer between the 0 and upper index.
-
getInteger
public static int getInteger(int lowerIndex, int upperIndex)
This calls the next double function and returns an integer between the lower index and upper index.
-
-