To get a random int in [a, b] (inclusive), use
- Acheck_circle
(int)(Math.random() * (b - a + 1)) + a
- B
(int)(Math.random() * (b - a)) + a
- C
(int) Math.random() * b + a
- D
(int)(Math.random() * b)
Explanation
Multiply by (b - a + 1) to include b; add a to shift range.