Interface RandomGenerator


public interface RandomGenerator
Random number generator
Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns a random double between 0.0 (inclusive) and 1.0 (exclusive).
    double
    nextDouble(double bound)
    Returns a random double between 0.0 (inclusive) and the specified bound (exclusive).
    double
    nextDouble(double start, double end)
    Returns a random double between the specified start (inclusive) and end (exclusive).
    int
    Returns a random integer across the entire int range, including negative values.
    int
    nextInt(int bound)
    Returns a random integer between 0 (inclusive) and the specified bound (exclusive).
    int
    nextInt(int start, int end)
    Returns a random integer between the specified start (inclusive) and end (exclusive).
  • Method Details

    • nextInt

      int nextInt(int start, int end)
      Returns a random integer between the specified start (inclusive) and end (exclusive).
      Parameters:
      start - the lower bound (inclusive)
      end - the upper bound (exclusive)
      Returns:
      a random integer in range [start, end), or 0 if start > end
    • nextInt

      int nextInt(int bound)
      Returns a random integer between 0 (inclusive) and the specified bound (exclusive).
      Parameters:
      bound - the upper bound (exclusive)
      Returns:
      a random integer in range [0, bound)
    • nextInt

      int nextInt()
      Returns a random integer across the entire int range, including negative values.
      Returns:
      a random integer
    • nextDouble

      double nextDouble(double start, double end)
      Returns a random double between the specified start (inclusive) and end (exclusive).
      Parameters:
      start - the lower bound (inclusive)
      end - the upper bound (exclusive)
      Returns:
      a random double in range [start, end), or 0 if start > end
    • nextDouble

      double nextDouble(double bound)
      Returns a random double between 0.0 (inclusive) and the specified bound (exclusive).
      Parameters:
      bound - the upper bound (exclusive)
      Returns:
      a random double in range [0, bound)
    • nextDouble

      double nextDouble()
      Returns a random double between 0.0 (inclusive) and 1.0 (exclusive).
      Returns:
      a random double in range [0, 1)