Package edu.wisc.game.util

## Class RandomRG

- java.lang.Object
- - java.util.Random
  - - edu.wisc.game.util.RandomRG

- All Implemented Interfaces:
    `Serializable`

      public class RandomRG
      extends Random

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RandomRG()` |
    `RandomRG​(long seed)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `getBoolean​(double p)` |
    `<T extends Enum<T>> T` | `getEnum​(Class<T> retType)` | Get a random value of a specified enum class
    `int` | `getExp​(int M, double L)` |
    `double` | `getExpDouble​(double M, double L)` | Returns an exponentially distributed random real number in the range [0, M], with the probability density dropping by e at L.
    `int` | `getInRange​(int[] z)` |
    `int` | `getInRange​(int min, int max)` | Generates a random integer number x, uniformly distributed among the (max-min+1) values: min ≤ x ≤ max.
    `Vector<Integer>` | `randomSubsetOrdered​(int n, int m)` | A random subset of m numbers out of [0:n-1], in ascending order
    `Vector<Integer>` | `randomSubsetPermuted​(int n, int m)` | A random subset of m numbers out of [0:n-1], in random order
    `Vector<Integer>` | `randomVector​(int n, int m)` | A random "bag" of m numbers, each one independently drawn out of [0:n-1]

    - ### Methods inherited from class java.util.Random

      `doubles, doubles, doubles, doubles, ints, ints, ints, ints, longs, longs, longs, longs, next, nextBoolean, nextBytes, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong, setSeed`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RandomRG

          public RandomRG()

    - #### RandomRG

          public RandomRG​(long seed)

  - ### Method Detail

    - #### getBoolean

          public boolean getBoolean​(double p)

      Parameters:
        `p` - The probability of the return value being true
      Returns:
        a random boolean number.

    - #### getInRange

          public int getInRange​(int min,
                                int max)

      Generates a random integer number x, uniformly distributed among the (max-min+1) values: min ≤ x ≤ max.

    - #### getInRange

          public int getInRange​(int[] z)

    - #### randomVector

          public Vector<Integer> randomVector​(int n,
                                              int m)

      A random "bag" of m numbers, each one independently drawn out of [0:n-1]

    - #### randomSubsetPermuted

          public Vector<Integer> randomSubsetPermuted​(int n,
                                                      int m)

      A random subset of m numbers out of [0:n-1], in random order

    - #### randomSubsetOrdered

          public Vector<Integer> randomSubsetOrdered​(int n,
                                                     int m)

      A random subset of m numbers out of [0:n-1], in ascending order

    - #### getExpDouble

          public double getExpDouble​(double M,
                                     double L)

      Returns an exponentially distributed random real number in the range [0, M], with the probability density dropping by e at L.

    - #### getExp

          public int getExp​(int M,
                            double L)

    - #### getEnum

          public <T extends Enum<T>> T getEnum​(Class<T> retType)

      Get a random value of a specified enum class