Class Randomizer

java.lang.Object
  |
  +--java.util.Random
        |
        +--Randomizer

class Randomizer
extends java.util.Random

Add a few useful methods to the standard Random class. This is Java 1.0 compatible, so I had to reimplement a few of the Java 1.2 Random additions.

See Also:
Serialized Form

Fields inherited from class java.util.Random
addend, BITS_PER_BYTE, BYTES_PER_INT, haveNextNextGaussian, mask, multiplier, nextNextGaussian, seed, serialVersionUID
 
Constructor Summary
Randomizer()
           
Randomizer(long seed)
           
 
Method Summary
 boolean nextBoolean()
          This is a copy of the code used for the Random nextBoolean() mehtod added in the JDK 1.2.
 java.awt.Color nextColor(double lo, double hi)
          Return a Color in which the red, green and blue each have a a brightness between lo and hi percent of the maximum value.
 double nextDouble(double hi)
          Return a double in the range 0 to hi exclusive of hi.
 double nextDouble(double lo, double hi)
          Return a double in the range lo to hi exclusive of hi.
 int nextInt(int n)
          This is a copy of the code used for the Random nextInt(int) mehtod added in the JDK 1.2.
 int nextInt(int lo, int hi)
          Return an int in the range lo to hi inclusive.
 
Methods inherited from class java.util.Random
next, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextLong, setSeed
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

Randomizer

public Randomizer()

Randomizer

public Randomizer(long seed)
Method Detail

nextDouble

public double nextDouble(double hi)
Return a double in the range 0 to hi exclusive of hi.

nextDouble

public double nextDouble(double lo,
                         double hi)
Return a double in the range lo to hi exclusive of hi.

nextBoolean

public boolean nextBoolean()
This is a copy of the code used for the Random nextBoolean() mehtod added in the JDK 1.2. We put it here so that we can use our class with earlier JDK. It returns a true or a false with equal likelihood.
Overrides:
nextBoolean in class java.util.Random

nextInt

public int nextInt(int n)
This is a copy of the code used for the Random nextInt(int) mehtod added in the JDK 1.2. We put it here so that we can use our class with earlier JDK. It returns an integer between 0 and n, exclusive of n.
Overrides:
nextInt in class java.util.Random

nextInt

public int nextInt(int lo,
                   int hi)
Return an int in the range lo to hi inclusive.

nextColor

public java.awt.Color nextColor(double lo,
                                double hi)
Return a Color in which the red, green and blue each have a a brightness between lo and hi percent of the maximum value.