generateRandomNumber static method

int generateRandomNumber(
  1. int min,
  2. int max
)

Generates a random integer between a minimum and maximum value (inclusive).

Implementation

static int generateRandomNumber(int min, int max) {
  return min + Random().nextInt(max - min + 1);
}