org.apache.commons.lang.math
public class RandomUtils extends Object
RandomUtils
is a wrapper that supports all possible
{@link java.util.Random} methods via the {@link java.lang.Math#random()}
method and its system-wide Random
object.
Since: 2.0
Version: $Id: RandomUtils.java 155423 2005-02-26 13:08:30Z dirkv $
Field Summary | |
---|---|
static Random | JVM_RANDOM
An instance of {@link JVMRandom}. |
Method Summary | |
---|---|
static boolean | nextBoolean() Returns the next pseudorandom, uniformly distributed boolean value from the Math.random() sequence. |
static boolean | nextBoolean(Random random) Returns the next pseudorandom, uniformly distributed boolean value from the given random sequence. |
static double | nextDouble() Returns the next pseudorandom, uniformly distributed float value
between |
static double | nextDouble(Random random) Returns the next pseudorandom, uniformly distributed float value
between |
static float | nextFloat() Returns the next pseudorandom, uniformly distributed float value
between |
static float | nextFloat(Random random) Returns the next pseudorandom, uniformly distributed float value
between |
static int | nextInt() Returns the next pseudorandom, uniformly distributed int value from the Math.random() sequence. |
static int | nextInt(Random random) Returns the next pseudorandom, uniformly distributed int value
from the given |
static int | nextInt(int n) Returns a pseudorandom, uniformly distributed int value
between |
static int | nextInt(Random random, int n) Returns a pseudorandom, uniformly distributed int value
between |
static long | nextLong() Returns the next pseudorandom, uniformly distributed long value from the Math.random() sequence. |
static long | nextLong(Random random) Returns the next pseudorandom, uniformly distributed long value from the given Random sequence. |
Returns the next pseudorandom, uniformly distributed boolean value from the Math.random() sequence.
Returns: the random boolean
Returns the next pseudorandom, uniformly distributed boolean value from the given random sequence.
Parameters: random the Random sequence generator.
Returns: the random boolean
Returns the next pseudorandom, uniformly distributed float value
between 0.0
and 1.0
from the Math.random()
sequence.
Returns: the random double
Returns the next pseudorandom, uniformly distributed float value
between 0.0
and 1.0
from the given Random
sequence.
Parameters: random the Random sequence generator.
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 the next pseudorandom, uniformly distributed float value
between 0.0
and 1.0
from the given Random
sequence.
Parameters: random the Random sequence generator.
Returns: the random float
Returns the next pseudorandom, uniformly distributed int value from the Math.random() sequence.
Returns: the random int
Returns the next pseudorandom, uniformly distributed int value
from the given random
sequence.
Parameters: random the Random sequence generator.
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
Returns a pseudorandom, uniformly distributed int value
between 0
(inclusive) and the specified value
(exclusive), from the given Random sequence.
Parameters: random the Random sequence generator. n the specified exclusive max-value
Returns: the random int
Returns the next pseudorandom, uniformly distributed long value from the Math.random() sequence.
Returns: the random long
Returns the next pseudorandom, uniformly distributed long value from the given Random sequence.
Parameters: random the Random sequence generator.
Returns: the random long