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 publicRandom
(); publicRandom
(long seed); // protected instance methods protected intnext
(int bits); // public instance methods public intnextInt
(); public longnextLong
(); public voidsetSeed
(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.