Class RandomUtils
- java.lang.Object
 - 
- org.apache.commons.lang.math.RandomUtils
 
 
- 
@Deprecated(since="2021-04-30") public class RandomUtils extends java.lang.ObjectDeprecated.Commons Lang 2 is in maintenance mode. Commons Lang 3 should be used instead.RandomUtilsis a wrapper that supports all possibleRandommethods via theMath.random()method and its system-wideRandomobject.- Since:
 - 2.0
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static java.util.RandomJVM_RANDOMDeprecated.An instance ofJVMRandom. 
- 
Constructor Summary
Constructors Constructor Description RandomUtils()Deprecated. 
- 
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static booleannextBoolean()Deprecated.Returns the next pseudorandom, uniformly distributed boolean value from the Math.random() sequence.static booleannextBoolean(java.util.Random random)Deprecated.Returns the next pseudorandom, uniformly distributed boolean value from the given random sequence.static doublenextDouble()Deprecated.Returns the next pseudorandom, uniformly distributed float value between0.0and1.0from the Math.random() sequence.static doublenextDouble(java.util.Random random)Deprecated.Returns the next pseudorandom, uniformly distributed float value between0.0and1.0from the given Random sequence.static floatnextFloat()Deprecated.Returns the next pseudorandom, uniformly distributed float value between0.0and1.0from the Math.random() sequence.static floatnextFloat(java.util.Random random)Deprecated.Returns the next pseudorandom, uniformly distributed float value between0.0and1.0from the given Random sequence.static intnextInt()Deprecated.Returns the next pseudorandom, uniformly distributed int value from the Math.random() sequence.static intnextInt(int n)Deprecated.Returns a pseudorandom, uniformly distributed int value between0(inclusive) and the specified value (exclusive), from the Math.random() sequence.static intnextInt(java.util.Random random)Deprecated.Returns the next pseudorandom, uniformly distributed int value from the givenrandomsequence.static intnextInt(java.util.Random random, int n)Deprecated.Returns a pseudorandom, uniformly distributed int value between0(inclusive) and the specified value (exclusive), from the given Random sequence.static longnextLong()Deprecated.Returns the next pseudorandom, uniformly distributed long value from the Math.random() sequence.static longnextLong(java.util.Random random)Deprecated.Returns the next pseudorandom, uniformly distributed long value from the given Random sequence. 
 - 
 
- 
- 
Field Detail
- 
JVM_RANDOM
public static final java.util.Random JVM_RANDOM
Deprecated.An instance ofJVMRandom. 
 - 
 
- 
Method Detail
- 
nextInt
public static int nextInt()
Deprecated.Returns the next pseudorandom, uniformly distributed int value from the Math.random() sequence.
N.B. All values are >= 0.- Returns:
 - the random int
 
 
- 
nextInt
public static int nextInt(java.util.Random random)
Deprecated.Returns the next pseudorandom, uniformly distributed int value from the given
randomsequence.- Parameters:
 random- the Random sequence generator.- Returns:
 - the random int
 
 
- 
nextInt
public static int nextInt(int n)
Deprecated.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
 
 
- 
nextInt
public static int nextInt(java.util.Random random, int n)Deprecated.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
 
 
- 
nextLong
public static long nextLong()
Deprecated.Returns the next pseudorandom, uniformly distributed long value from the Math.random() sequence.
N.B. All values are >= 0.- Returns:
 - the random long
 
 
- 
nextLong
public static long nextLong(java.util.Random random)
Deprecated.Returns the next pseudorandom, uniformly distributed long value from the given Random sequence.
- Parameters:
 random- the Random sequence generator.- Returns:
 - the random long
 
 
- 
nextBoolean
public static boolean nextBoolean()
Deprecated.Returns the next pseudorandom, uniformly distributed boolean value from the Math.random() sequence.
- Returns:
 - the random boolean
 
 
- 
nextBoolean
public static boolean nextBoolean(java.util.Random random)
Deprecated.Returns the next pseudorandom, uniformly distributed boolean value from the given random sequence.
- Parameters:
 random- the Random sequence generator.- Returns:
 - the random boolean
 
 
- 
nextFloat
public static float nextFloat()
Deprecated.Returns the next pseudorandom, uniformly distributed float value between
0.0and1.0from the Math.random() sequence.- Returns:
 - the random float
 
 
- 
nextFloat
public static float nextFloat(java.util.Random random)
Deprecated.Returns the next pseudorandom, uniformly distributed float value between
0.0and1.0from the given Random sequence.- Parameters:
 random- the Random sequence generator.- Returns:
 - the random float
 
 
- 
nextDouble
public static double nextDouble()
Deprecated.Returns the next pseudorandom, uniformly distributed float value between
0.0and1.0from the Math.random() sequence.- Returns:
 - the random double
 
 
- 
nextDouble
public static double nextDouble(java.util.Random random)
Deprecated.Returns the next pseudorandom, uniformly distributed float value between
0.0and1.0from the given Random sequence.- Parameters:
 random- the Random sequence generator.- Returns:
 - the random double
 
 
 - 
 
 -