Generating a Random Number between 1 and 10 Java [duplicate]
As the documentation says, this method call returns “a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive)”. This means that you will get numbers from 0 to 9 in your case. So you’ve done everything correctly by adding one to that number. Generally speaking, if you need to generate numbers from min to max (including both), … Read more