Generating a random index for an array
java
Solution
What do you mean? Array indices are normal numbers, so you can easily do
String names[] = { "One", "Two", "Three", "Four", "Five", "Six" };
Random Dice = new Random();
int n = Dice.nextInt(6);
System.out.println(names[n]);
Or do you mean a random Iterator class? Google is your friend here, this is the first hit I get.
Problem
I know this for normal integers, but is there for such a thing as indices? ``` Random dice = new Random(); int n = dice.nextInt(6); System.out.println(n); ```