// generate the name of a random fruit. import java.util.Random; // ... static final Random wheel = new Random(); static final String[] fruits = { "peach", "orange", "cherry", "pineapple", "guava" }; // ... // count how many possible fruits there are: 5 numbered 0..4. int n = fruits.length; // generate a random number = 0..4 which picks one of the 5 fruits. int r = wheel.nextInt( n ); // turn that number into the name of a random fruit. String fruit = fruits[ r ];