Пример #1
0
  /**
   * Generates a random color as an integer, from Color and three random floats.
   *
   * @return int: An integer based representation of a Color.
   */
  public static int getRandomColor() {

    return new Color(
            Constants.RANDOM.nextFloat(),
            Constants.RANDOM.nextFloat(),
            Constants.RANDOM.nextFloat())
        .getRGB();
  }
Пример #2
0
  /**
   * Used to retrieve a random integer between the two provided integers. The integers provided are
   * also possible outcomes.
   *
   * @param min: The minimum value which can be returned by this method.
   * @param max: The maximum value which can be returned by this method.
   */
  public static int nextIntInclusive(int min, int max) {

    return Constants.RANDOM.nextInt(max - min + 1) + min;
  }