java.util
Class Random

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

public class Random
extends Object

Pseudo-random number generation. No-arg constructor and nextInt(int) method added. (David J. Barnes)


Constructor Summary
Random()
          Use the current system time as the default seed.
Random(long seed)
           
 
Method Summary
 double nextDouble()
          Random number generator.
 int nextInt()
           
 int nextInt(int n)
          Return A positive value in the range 0 ...
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait
 

Constructor Detail

Random

public Random()
Use the current system time as the default seed.


Random

public Random(long seed)
Method Detail

nextInt

public int nextInt()
Returns:
A random positive or negative integer.

nextInt

public int nextInt(int n)
Return A positive value in the range 0 ... (n-1). This is a simplified version from that in the standard Java API.

Parameters:
n - The limit (exclusive) - must be positive.
Returns:
A positive value in the range 0 (inclusive) ... n exclusive.

nextDouble

public double nextDouble()
Random number generator. Copied from java.lang.Math. Returns a double greater than 0.0 and less than 1.0