Packages This Package Prev Next Index
public class java.util.Random
extends java.lang.Object (I-§1.12)
{
// Constructors
public Random(); §3.7.1
public Random(long seed); §3.7.2
// Methods
public double nextDouble(); §3.7.3
public float nextFloat(); §3.7.4
public double nextGaussian(); §3.7.5
public int nextInt(); §3.7.6
public long nextLong(); §3.7.7
public void setSeed(long seed); §3.7.8
}
An instance of this class is used to generate a stream of pseudo-random numbers. The
class uses a 48-bit seed, which is modified using a linear congruential formula. See
Donald Knuth, The Art of Computer Programming, Volume 2, Section 3.2.1.
Many applications will find the random method (I-§1.10.26) in class Math simpler to use.
public Random()
public Random(long seed)
seed
- the initial seed
public double nextDouble()
public float nextFloat()
public double nextGaussian()
public int nextInt()
public long nextLong()