For generating random numbers, I've used the formula:
(int)(Math.random() * max) + min
The formula I find on Google always seem to be:
(int)(Math.random() * (max - min) + min)
Which one's right? As far as I know, I've never gotten a number that was out of my range with my formula
max
should really be namedrange
orwidth
.