This java program generates a random number between 1-6. It also allows the user to choose how many random numbers between 1-6 to generate. I now need to record and output how many instances of each number came up. ie. How many times each number 1,2,3,4,5,6 came up in a single run of the program. How would I go about doing this? Here is what I have so far.
import java.util.Random;
public class DiceRandomness {
public static void main(String[] args) {
Random generator = new Random();
System.out.print("How many throws of the dice: ");
int num = Console.readInt();
int[] Results = new int[10000];
for (int i = 0; i < num; i++) {
int d = 1 + generator.nextInt(6);
System.out.println(d + " ");
}
}
}