Sep
25
|
The Random class provides a method to return a random integer between 0 and n (exclusive) which can be used. Just add one to the returned value to shift the range from 0-n-1 to 1-n
Random wheel = new Random(); int random = wheel.nextInt(n) + 1;
Leave a Reply
You must be logged in to post a comment.