Commit 614422e
Improved test for roll_the_die
- Tests now check whether multiple rolls supply different results
- RollDie is checked for returning all values in the expected range
- Increased for loop from 100 times to 1000 times to prevent false negative. Encountered that 100 rolls was not sufficient to have all numbers in range(1, 18) to be generated.
Rationale:
My first implementation (thanks XKCD) made the test suite pass.
```
public int RollDie()
{
return 4; // chosen by fair dice roll.
// guaranteed to be random.
}
```1 parent 9082055 commit 614422e
1 file changed
+16
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | | - | |
| 13 | + | |
11 | 14 | | |
| 15 | + | |
| 16 | + | |
12 | 17 | | |
13 | 18 | | |
| 19 | + | |
14 | 20 | | |
15 | 21 | | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
| 26 | + | |
| 27 | + | |
20 | 28 | | |
21 | | - | |
22 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
23 | 36 | | |
24 | 37 | | |
0 commit comments