How can I generate a random number in a certain range?
To extend what Rahul Gupta said: You can use Java function int random = Random.nextInt(n). This returns a random int in the range [0, n-1]. I.e., to get the range [20, 80] use: final int random = new Random().nextInt(61) + 20; // [0, 60] + 20 => [20, 80] To generalize more: final int min … Read more