org.apache.commons.lang.math
public final class JVMRandom extends Random
JVMRandom
is a wrapper that supports all possible
Random methods via the {@link java.lang.Math#random()} method
and its system-wide {@link Random} object.
Since: 2.0
Version: $Id: JVMRandom.java 161229 2005-04-13 22:36:48Z ggregory $
Constructor Summary | |
---|---|
JVMRandom()
Constructs a new instance. |
Method Summary | |
---|---|
boolean | nextBoolean() Returns the next pseudorandom, uniformly distributed boolean value from the Math.random() sequence. |
void | nextBytes(byte[] byteArray)
Unsupported in 2.0.
|
double | nextDouble() Synonymous to the Math.random() call. |
float | nextFloat() Returns the next pseudorandom, uniformly distributed float value
between |
double | nextGaussian()
Unsupported in 2.0.
|
int | nextInt() Returns the next pseudorandom, uniformly distributed int value from the Math.random() sequence. |
int | nextInt(int n) Returns a pseudorandom, uniformly distributed int value between
|
long | nextLong() Returns the next pseudorandom, uniformly distributed long value from the Math.random() sequence. |
static long | nextLong(long n) Returns a pseudorandom, uniformly distributed long value between
|
void | setSeed(long seed)
Unsupported in 2.0.
|
Returns the next pseudorandom, uniformly distributed boolean value from the Math.random() sequence.
Returns: the random boolean
Parameters: byteArray ignored
Throws: UnsupportedOperationException
Synonymous to the Math.random() call.
Returns: the random double
Returns the next pseudorandom, uniformly distributed float value
between 0.0
and 1.0
from the Math.random()
sequence.
Returns: the random float
Returns: Nothing, this method always throws an UnsupportedOperationException.
Throws: UnsupportedOperationException
Returns the next pseudorandom, uniformly distributed int value from the Math.random() sequence.
Returns: the random int
Returns a pseudorandom, uniformly distributed int value between
0
(inclusive) and the specified value (exclusive), from
the Math.random() sequence.
Parameters: n the specified exclusive max-value
Returns: the random int
Throws: IllegalArgumentException when n <= 0
Returns the next pseudorandom, uniformly distributed long value from the Math.random() sequence.
Returns: the random long
Returns a pseudorandom, uniformly distributed long value between
0
(inclusive) and the specified value (exclusive), from
the Math.random() sequence.
Parameters: n the specified exclusive max-value
Returns: the random long
Throws: IllegalArgumentException when n <= 0
Parameters: seed ignored
Throws: UnsupportedOperationException