RoboJDETM v2.0

java.util
Class Random

java.lang.Object
  extended by java.util.Random

public class Random
extends Object

This class implements a pseudo-random number generator.


Constructor Summary
Random()
          Constructs a random number generator using the system clock to generate the seed.
Random(long seed)
          Constructs a random number generator given a seed.
 
Method Summary
protected  int next(int bits)
           
 int nextInt()
          Returns the next random integer.
 int nextInt(int n)
          Returns a random integer between 0 and n-1.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait
 

Constructor Detail

Random

public Random()
Constructs a random number generator using the system clock to generate the seed.


Random

public Random(long seed)
Constructs a random number generator given a seed.

Parameters:
seed - The seed.
Method Detail

next

protected int next(int bits)

nextInt

public int nextInt()
Returns the next random integer.

Returns:
a random positive or negative integer.

nextInt

public int nextInt(int n)
Returns a random integer between 0 and n-1.

Parameters:
n - a positive integer
Returns:
a random integer in the range 0 to n-1

RoboJDETM v2.0

Copyright (c) 2003-2009 RidgeSoft, LLC. All rights reserved.
www.ridgesoft.com