Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class DiceRoll {
- public static void main(String[] args) {
- int[] results = new int[11];
- for (int i = 0; i < 36000; i++) {
- results[Roll()] += 1;
- }
- for (int i = 0; i < 11; i++) {
- System.out.print(i+2 + " : ");
- System.out.println(results[i]);
- }
- }
- public static int Roll() {
- int[] dice = new int[2];
- dice[0] = new Random().nextInt(6);
- dice[1] = new Random().nextInt(6);
- return dice[0] + dice[1];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement