fork download
  1. import java.util.Random;
  2.  
  3. class Probability {
  4. private static final int[] BOUNDS = {
  5. 720,1800,3592,7240,14416,
  6. 25552,42592,69052,109156,159932,
  7. 218948,279608,335408,376000,400284,
  8. 411252,414580,415356,415436,415440};
  9.  
  10. public static void main(String[] args) {
  11. Random r = new Random();
  12.  
  13. int[] results = new int[200];
  14.  
  15. for(int k = 0; k < 1_000_000; k++) {
  16. int score = 0;
  17. for(int j = 0; j < 7; j++) {
  18. int combo = r.nextInt(415440);
  19. int i;
  20. for(i = 0; i < 20; i++) {
  21. if(combo < BOUNDS[i]) break;
  22. }
  23. score += i+1;
  24. }
  25. results[score]++;
  26. }
  27.  
  28. for(int i = 0; i < 200; i++) {
  29. // Formatting the output to be easily placed into latex
  30. if(results[i] > 0) System.out.println(i + " & " + results[i] + " \\\\");
  31. }
  32. }
  33. }
Success #stdin #stdout 0.7s 380160KB
stdin
Standard input is empty
stdout
38 & 1 \\
39 & 1 \\
41 & 4 \\
42 & 2 \\
43 & 3 \\
44 & 11 \\
45 & 7 \\
46 & 25 \\
47 & 34 \\
48 & 49 \\
49 & 62 \\
50 & 92 \\
51 & 179 \\
52 & 259 \\
53 & 338 \\
54 & 506 \\
55 & 722 \\
56 & 1045 \\
57 & 1536 \\
58 & 1994 \\
59 & 2685 \\
60 & 3448 \\
61 & 4708 \\
62 & 5961 \\
63 & 7660 \\
64 & 9855 \\
65 & 12282 \\
66 & 14977 \\
67 & 18299 \\
68 & 21664 \\
69 & 25651 \\
70 & 29723 \\
71 & 34115 \\
72 & 38615 \\
73 & 42702 \\
74 & 46056 \\
75 & 49401 \\
76 & 52053 \\
77 & 53595 \\
78 & 54433 \\
79 & 54123 \\
80 & 53019 \\
81 & 51099 \\
82 & 47915 \\
83 & 44103 \\
84 & 39543 \\
85 & 35153 \\
86 & 30095 \\
87 & 25388 \\
88 & 20919 \\
89 & 16989 \\
90 & 13064 \\
91 & 9961 \\
92 & 7417 \\
93 & 5432 \\
94 & 3875 \\
95 & 2655 \\
96 & 1711 \\
97 & 1158 \\
98 & 675 \\
99 & 404 \\
100 & 262 \\
101 & 138 \\
102 & 72 \\
103 & 41 \\
104 & 22 \\
105 & 10 \\
106 & 1 \\
107 & 2 \\
109 & 1 \\