RandomUtils (Lang 2.6)
Date: 2019-01-01

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 `Random` methods via the `Math.random()` method and its system-wide `Random` object.

  Since:
    2.0
  Version:
    $Id: RandomUtils.java 906320 2010-02-04 01:41:10Z sebb $

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.util.Random` | `JVM_RANDOM` An instance of `JVMRandom`.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RandomUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `nextBoolean()` Returns the next pseudorandom, uniformly distributed boolean value from the Math.random() sequence.
    `static boolean` | `nextBoolean(java.util.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(java.util.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(java.util.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(java.util.Random random)` Returns the next pseudorandom, uniformly distributed int value from the given `random` sequence.
    `static int` | `nextInt(java.util.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(java.util.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

    - #### JVM_RANDOM

          public static final java.util.Random JVM_RANDOM

      An instance of `JVMRandom`.

  - ### Constructor Detail

    - #### RandomUtils

          public RandomUtils()

  - ### Method Detail

    - #### nextInt

          public static int nextInt()

      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)

      Returns the next pseudorandom, uniformly distributed int value from the given `random` sequence.

      Parameters:
        `random` - the Random sequence generator.
      Returns:
        the random int

    - #### 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.

      Parameters:
        `n` - the specified exclusive max-value
      Returns:
        the random int

    - #### nextInt

          public static int nextInt(java.util.Random random,
                                    int n)

      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()

      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)

      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()

      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)

      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()

      Returns the next pseudorandom, uniformly distributed float value between `0.0` and `1.0` from the Math.random() sequence.

      Returns:
        the random float

    - #### nextFloat

          public static float nextFloat(java.util.Random random)

      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

    - #### nextDouble

          public static double nextDouble()

      Returns the next pseudorandom, uniformly distributed float value between `0.0` and `1.0` from the Math.random() sequence.

      Returns:
        the random double

    - #### nextDouble

          public static double nextDouble(java.util.Random random)

      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

Copyright © 2001-2019 - Apache Software Foundation