org.apache.commons.lang.math
Class RandomUtils
java.lang.Object
org.apache.commons.lang.math.RandomUtils
public class RandomUtils
extends java.lang.Object
RandomUtils
is a wrapper that supports all possible
java.util.Random
methods via the java.lang.Math.random()
method and its system-wide Random
object.
Version:
- Henri Yandell
- 2.0
static boolean | nextBoolean() - Returns the next pseudorandom, uniformly distributed boolean value
from the Math.random() sequence.
|
static boolean | nextBoolean(Random rnd)
|
static double | nextDouble() - Synonymous to the Math.random() call.
|
static double | nextDouble(Random rnd)
|
static float | nextFloat() - Returns the next pseudorandom, uniformly distributed float value
between
0.0 and 1.0 from the Math.random()
sequence.
|
static float | nextFloat(Random rnd)
|
static int | nextInt() - Returns the next pseudorandom, uniformly distributed int value
from the Math.random() sequence.
|
static int | nextInt(Random rnd)
|
static int | nextInt(Random rnd, int n)
|
static int | nextInt(int n) - Returns a pseudorandom, uniformly distributed int value
between
0 (inclusive) and the specified value
(exclusive), from the Math.random() sequence.
|
static long | nextLong() - Returns the next pseudorandom, uniformly distributed long value
from the Math.random() sequence.
|
static long | nextLong(Random rnd)
|
JVM_RANDOM
public static final Random JVM_RANDOM
nextBoolean
public static boolean nextBoolean()
Returns the next pseudorandom, uniformly distributed boolean value
from the Math.random() sequence.
- the random boolean
nextBoolean
public static boolean nextBoolean(Random rnd)
nextDouble
public static double nextDouble()
Synonymous to the Math.random() call.
- the random double
nextDouble
public static double nextDouble(Random rnd)
nextFloat
public static float nextFloat()
Returns the next pseudorandom, uniformly distributed float value
between 0.0
and 1.0
from the Math.random()
sequence.
- the random float
nextFloat
public static float nextFloat(Random rnd)
nextInt
public static int nextInt()
Returns the next pseudorandom, uniformly distributed int value
from the Math.random() sequence.
- the random int
nextInt
public static int nextInt(Random rnd)
nextInt
public static int nextInt(Random rnd,
int n)
nextInt
public static int nextInt(int n)
Returns a pseudorandom, uniformly distributed int value
between 0
(inclusive) and the specified value
(exclusive), from the Math.random() sequence.
n
- the specified exclusive max-value
- the random int
nextLong
public static long nextLong()
Returns the next pseudorandom, uniformly distributed long value
from the Math.random() sequence.
- the random long
nextLong
public static long nextLong(Random rnd)
Copyright © 2001-2003 - Apache Software Foundation