Class RandomGenerator

java.lang.Object
net.flectone.pulse.util.generator.RandomGenerator

public class RandomGenerator extends Object
Random number generator
Since:
0.1.0
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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).

    Methods inherited from class Object

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

    • RandomGenerator

      @Inject public RandomGenerator()
  • Method Details

    • nextInt

      public 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

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