Module hash4j

Interface PseudoRandomGenerator


public interface PseudoRandomGenerator
A pseudo-random generator.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns a random uniformly distributed double value in the range [0, 1).
    double
    Returns an exponentially distributed double value with mean 1.
    int
    Returns a random uniformly distributed 32-bit int value.
    long
    Returns a random uniformly distributed 64-bit long value.
    reset(long seed)
    Resets the pseudo-random generator using the given 64-bit seed value.
    int
    uniformInt(int exclusiveBound)
    Returns a random uniformly distributed 32-bit {code int} value greater than or equal to 0 and less than the given upper bound.
  • Method Details

    • nextLong

      long nextLong()
      Returns a random uniformly distributed 64-bit long value.
      Returns:
      a random value
    • nextInt

      int nextInt()
      Returns a random uniformly distributed 32-bit int value.
      Returns:
      a random value
    • uniformInt

      int uniformInt(int exclusiveBound)
      Returns a random uniformly distributed 32-bit {code int} value greater than or equal to 0 and less than the given upper bound.

      The behavior is undefined, if the given upper bound is non-positive.

      Parameters:
      exclusiveBound - the (exclusive) upper bound (must be positve)
      Returns:
      a random value
    • reset

      PseudoRandomGenerator reset(long seed)
      Resets the pseudo-random generator using the given 64-bit seed value.
      Parameters:
      seed - the seed value
      Returns:
      this
    • nextDouble

      double nextDouble()
      Returns a random uniformly distributed double value in the range [0, 1).
      Returns:
      a random value
    • nextExponential

      double nextExponential()
      Returns an exponentially distributed double value with mean 1.
      Returns:
      a random value