Name

java.util.Random

Synopsis

This class is a smaller version of the J2SE Random class and is used as a pseudo-random number generator. The constructor takes a long integer seed, which it uses to initialize the random number generator. The nextInt() and nextLong() methods can then be used to create random numbers of the appropriate data type. The seed can be reset using the setSeed() method.

public classRandom {
   // constructors
   public Random();
   public Random(long seed);

   // protected instance methods
   protected int next(int bits);

   // public instance methods
   public int nextInt();
   public long nextLong();
   public void setSeed(long seed);
}

Get Wireless Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.