Trying to random an integer between 15-20, inclusive.
Am I implementing this code correctly?
Random radiusChooser = new Random();
radius = radiusChooser.nextInt(21)-6;
Trying to random an integer between 15-20, inclusive.
Am I implementing this code correctly?
Random radiusChooser = new Random();
radius = radiusChooser.nextInt(21)-6;
Try this instead:
radius = radiusChooser.nextInt(6) + 15;
This will choose a random number between 0 and 5 (inclusive) and then add 15 to it - which gives you a random number between 15 and 20 (inclusive).