(String[] args)
| 15 | } |
| 16 | |
| 17 | public static void main(String[] args) { |
| 18 | /* Test: call rand7 many times and inspect the results. */ |
| 19 | int[] arr = new int[7]; |
| 20 | int test_size = 1000000; |
| 21 | for(int k = 0; k < test_size; k++){ |
| 22 | arr[rand7()]++; |
| 23 | } |
| 24 | |
| 25 | for (int i = 0; i < 7; i++) { |
| 26 | double percent = 100.0 * arr[i] / test_size; |
| 27 | System.out.println(i + " appeared " + percent + "% of the time."); |
| 28 | } |
| 29 | } |
| 30 | } |