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
-
r
- A static instance of a Random that is used throughout the
gpjpp package.
-
flip(double)
- Returns true if a random real in the range from 0.0 to 100.0
is less than the specified percent.
-
nextDouble()
- Returns a random double uniformly distributed in the range
0.0 to 1.0.
-
nextInt(int)
- Returns a random integer uniformly distributed in the range
0 to limit-1.
-
setGenerator(Random)
- Sets the static field r to an instance of Random.
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.
setGenerator
public static void setGenerator(Random ran)
- Sets the static field r to an instance of Random.
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.
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.
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