|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.lang.math.RandomUtils
public class RandomUtils
RandomUtils
is a wrapper that supports all possible
Random
methods via the Math.random()
method and its system-wide Random
object.
Field Summary | |
---|---|
static Random |
JVM_RANDOM
An instance of JVMRandom . |
Constructor Summary | |
---|---|
RandomUtils()
|
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 0.0 and 1.0 from the Math.random()
sequence. |
static double |
nextDouble(Random random)
Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from the given Random
sequence. |
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 random)
Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from the given Random
sequence. |
static int |
nextInt()
Returns the next pseudorandom, uniformly distributed int value from the Math.random() sequence. |
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 int |
nextInt(Random random)
Returns the next pseudorandom, uniformly distributed int value from the given random sequence. |
static int |
nextInt(Random random,
int n)
Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value
(exclusive), from the given Random sequence. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Random JVM_RANDOM
JVMRandom
.
Constructor Detail |
---|
public RandomUtils()
Method Detail |
---|
public static int nextInt()
Returns the next pseudorandom, uniformly distributed int value from the Math.random() sequence.
N.B. All values are >= 0.
public static int nextInt(Random random)
Returns the next pseudorandom, uniformly distributed int value
from the given random
sequence.
random
- the Random sequence generator.
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
public static int nextInt(Random random, int n)
Returns a pseudorandom, uniformly distributed int value
between 0
(inclusive) and the specified value
(exclusive), from the given Random sequence.
random
- the Random sequence generator.n
- the specified exclusive max-value
public static long nextLong()
Returns the next pseudorandom, uniformly distributed long value from the Math.random() sequence.
N.B. All values are >= 0.
public static long nextLong(Random random)
Returns the next pseudorandom, uniformly distributed long value from the given Random sequence.
random
- the Random sequence generator.
public static boolean nextBoolean()
Returns the next pseudorandom, uniformly distributed boolean value from the Math.random() sequence.
public static boolean nextBoolean(Random random)
Returns the next pseudorandom, uniformly distributed boolean value from the given random sequence.
random
- the Random sequence generator.
public static float nextFloat()
Returns the next pseudorandom, uniformly distributed float value
between 0.0
and 1.0
from the Math.random()
sequence.
public static float nextFloat(Random random)
Returns the next pseudorandom, uniformly distributed float value
between 0.0
and 1.0
from the given Random
sequence.
random
- the Random sequence generator.
public static double nextDouble()
Returns the next pseudorandom, uniformly distributed float value
between 0.0
and 1.0
from the Math.random()
sequence.
public static double nextDouble(Random random)
Returns the next pseudorandom, uniformly distributed float value
between 0.0
and 1.0
from the given Random
sequence.
random
- the Random sequence generator.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |