Class RandNumGenerator

java.lang.Object
  |
  +--RandNumGenerator

public class RandNumGenerator
extends java.lang.Object

Marine Biology Simulation: The RandNumGenerator class provides a singleton java.util.Random object for random number generation. Using this class, many different objects can share a single source of random numbers. This eliminates the potential problem of having multiple random number generators generating sequences of numbers that are too similar.

Example of how to use RandNumGenerator:


       import java.util.Random;

       Random randNumGen = RandNumGenerator.getInstance();
       int randomNum = randNumGen.nextInt();
       double randomDouble = randNumGen.nextDouble();
    

See Also:
Random

Constructor Summary
RandNumGenerator()
           
 
Method Summary
static java.util.Random getInstance()
          Returns a random number generator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandNumGenerator

public RandNumGenerator()
Method Detail

getInstance

public static java.util.Random getInstance()
Returns a random number generator. Always returns the same Random object to provide a better sequence of random numbers.