Class RandomUtil

java.lang.Object
cc.redberry.rings.util.RandomUtil

public final class RandomUtil
extends Object
Since:
1.0
  • Method Summary

    Modifier and Type Method Description
    static BigInteger[] randomBigIntegerArray​(int length, BigInteger min, BigInteger max, org.apache.commons.math3.random.RandomGenerator rnd)
    Creates random array of length degree + 1 with elements bounded by bound (by absolute value).
    static BigInteger randomInt​(BigInteger bound, org.apache.commons.math3.random.RandomGenerator rnd)
    Returns random integer in range [0, bound).
    static int[] randomIntArray​(int length, int min, int max, org.apache.commons.math3.random.RandomGenerator rnd)
    Creates random array of length degree + 1 with elements bounded by bound (by absolute value).
    static long[] randomLongArray​(int length, long min, long max, org.apache.commons.math3.random.RandomGenerator rnd)
    Creates random array of length degree + 1 with elements bounded by bound (by absolute value).
    static int[] randomSharpIntArray​(int length, int total, org.apache.commons.math3.random.RandomGenerator rnd)
    Creates random array of length degree + 1 with elements bounded by bound (by absolute value).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • randomIntArray

      public static int[] randomIntArray​(int length, int min, int max, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random array of length degree + 1 with elements bounded by bound (by absolute value).
      Parameters:
      length - array length
      min - min value
      max - max value
      rnd - random source
      Returns:
      array of length length with elements bounded by bound (by absolute value)
    • randomSharpIntArray

      public static int[] randomSharpIntArray​(int length, int total, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random array of length degree + 1 with elements bounded by bound (by absolute value).
      Parameters:
      length - array length
      total - total
      rnd - random source
      Returns:
      array of length length with elements bounded by bound (by absolute value)
    • randomLongArray

      public static long[] randomLongArray​(int length, long min, long max, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random array of length degree + 1 with elements bounded by bound (by absolute value).
      Parameters:
      length - array length
      min - min value
      max - max value
      rnd - random source
      Returns:
      array of length length with elements bounded by bound (by absolute value)
    • randomBigIntegerArray

      public static BigInteger[] randomBigIntegerArray​(int length, BigInteger min, BigInteger max, org.apache.commons.math3.random.RandomGenerator rnd)
      Creates random array of length degree + 1 with elements bounded by bound (by absolute value).
      Parameters:
      length - array length
      min - min value
      max - max value
      rnd - random source
      Returns:
      array of length length with elements bounded by bound (by absolute value)
    • randomInt

      public static BigInteger randomInt​(BigInteger bound, org.apache.commons.math3.random.RandomGenerator rnd)
      Returns random integer in range [0, bound).
      Parameters:
      bound - maximal allowed value
      rnd - random
      Returns:
      a BigInteger b so that 0 <= b < bound