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
`private static java.util.Random` `mRandom` The object containing the instance of the java.util.Random class.

### Constructor Summary

Constructors
Constructor and Description
`PegRandom()`

### Method Summary

All Methods Static Methods Concrete Methods
`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

#### mRandom

    private static java.util.Random mRandom

The object containing the instance of the java.util.Random class.

### Constructor Detail

#### PegRandom

    public PegRandom()

### 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.