Created
October 17, 2012 22:30
-
-
Save crysyn/3908752 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random; | |
import java.util.Scanner; | |
public class DiceProbability { | |
@SuppressWarnings("unused") | |
public static void main (String [] args) | |
{ | |
Scanner in = new Scanner(System.in); | |
Random randNumList = new Random(); | |
int[] times = new int[23]; | |
int rolls = in.nextInt(); | |
for(int i = 0; i < rolls; ++i) | |
times[randNumList.nextInt(12) + randNumList.nextInt(12)]++; | |
System.out.println("Sum of Dice Probability"); | |
for(int i = 0; i < 23; ++i) | |
System.out.println((i + 2) + "s: " + times[i]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment