Class gpjpp.GPRandom
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gpjpp.GPRandom

java.lang.Object
   |
   +----gpjpp.GPRandom

public class GPRandom
extends Object
Manages a static instance of the standard Random class, and adds a couple of random number methods that are of use to gpjpp. GPRandom cannot be instantiated; all members are static. It is designed this way in order to avoid having to pass an instance variable to various and dispersed methods of gpjpp.
Version:
1.0

Variable Index

 o r
A static instance of a Random that is used throughout the gpjpp package.

Method Index

 o flip(double)
Returns true if a random real in the range from 0.0 to 100.0 is less than the specified percent.
 o nextDouble()
Returns a random double uniformly distributed in the range 0.0 to 1.0.
 o nextInt(int)
Returns a random integer uniformly distributed in the range 0 to limit-1.
 o setGenerator(Random)
Sets the static field r to an instance of Random.

Variables

 o r
  protected static Random r
A static instance of a Random that is used throughout the gpjpp package. This must be valid before creating a population. It is instantiated automatically by the GPRun class.

Methods

 o setGenerator
  public static void setGenerator(Random ran)
Sets the static field r to an instance of Random.
 o nextInt
  public static int nextInt(int limit)
Returns a random integer uniformly distributed in the range 0 to limit-1. limit must 0 or greater.
 o flip
  public static boolean flip(double percent)
Returns true if a random real in the range from 0.0 to 100.0 is less than the specified percent. Thus, if percent is 50.0, the result has equal probability of returning true or false.
 o nextDouble
  public static double nextDouble()
Returns a random double uniformly distributed in the range 0.0 to 1.0. Simply calls r.nextDouble().

All Packages  Class Hierarchy  This Package  Previous  Next  Index