1
2//To get a random number between a set range with min and max:
3
4int number = random.nextInt(max - min) + min;
5//It also works with negative numbers.
6
7//So:
8
9random.nextInt(30 + 10) - 10;
10// max = 30; min = -10;
11//Will yield a random int between -10 and 30 (exclusive).
12
13//It also works with doubles.