RandomNameRandomSynopsis
DescriptionThe Random class is a pseudo-random number generator. Pseudo-random numbers are generated by starting with a seed value and then using an algorithm to generate a sequence of numbers that appear to be random. The Random class uses a 48-bit seed and a linear congruential algorithm to modify the seed. As a consequence of this implementation, two Random instances that are constructed with the same seed value generate exactly the same sequence of numbers. The Random class provides methods that return pseudo-random values for various primitive Java types. The Math.random() method is easier to use if you do not need to fine-tune the generation of random numbers. Class Summary
public class java.util.Random extends java.lang.Object implements java.io.Serializable { // Constructors public Random(); public Random(long seed); // Instance Methods public void nextBytes(byte[] bytes); // New in 1.1 public double nextDouble(); public float nextFloat(); public synchronized double nextGaussian(); public int nextInt(); public long nextLong(); public synchronized void setSeed(long seed); // Protected Instance Methods protected synchronized int next(int bits); // New in 1.1 } ConstructorsRandompublic Random()
public Random(long seed)
Instance MethodsnextBytespublic void nextBytes(byte[] bytes)
nextDoublepublic double nextDouble()
nextFloatpublic float nextFloat()
nextGaussianpublic synchronized double nextGaussian()
nextIntpublic int nextInt()
nextLongpublic long nextLong()
setSeedpublic synchronized void setSeed(long seed)
Protected Instance Methodsnextprotected synchronized int next(int bits)
Inherited Methods
See AlsoMath, Serializable |
|