Java Reference
In-Depth Information
public int nextInt(int ceiling)
Like nextInt() , but returns a value that is at least zero and is
less than the value ceiling . Use this instead of using nextInt()
and % to get a range. If ceiling is negative, an IllegalArgu-
mentException is thrown.
public long nextLong()
Returns a pseudorandom uniformly distributed long value
between Long.MIN_VALUE and Long.MAX_VALUE , inclusive.
public void nextBytes(byte[] buf)
Fills the array buf with random bytes.
public float nextFloat()
Returns a pseudorandom uniformly distributed float value
between 0.0f (inclusive) and 1.0f (exclusive).
public double nextdouble()
Returns a pseudorandom uniformly distributed double value
between 0.0 (inclusive) and 1.0 (exclusive).
public double nextGaussian()
Returns a pseudorandom Gaussian-distributed double value
with mean of 0.0 and standard deviation of 1.0.
All the next Type methods use the protected method next . The next meth-
od takes an int that represents the number of random bits to produce
(between 1 and 32) and returns an int with that many bits. These ran-
dom bits are then converted to the requested type. For example, nextInt
 
Search WWH ::




Custom Search