The Random class provides a method that returns a random integer between 0 and n (exclusive).
Random wheel = new Random(); int random = wheel.nextInt(n);
By default it uses the current timestamp as the seed for the random generator, or alternately you can provide your own.
Leave a Reply
You must be logged in to post a comment.