Randomly returns true ~"1/n" of the time, and false otherwise. REQUIRES: n > 0
| 68 | // Randomly returns true ~"1/n" of the time, and false otherwise. |
| 69 | // REQUIRES: n > 0 |
| 70 | bool OneIn(int n) { return (Next() % n) == 0; } |
| 71 | |
| 72 | // Skewed: pick "base" uniformly from range [0,max_log] and then |
| 73 | // return "base" random bits. The effect is to pick a number in the |
nothing calls this directly
no outgoing calls
no test coverage detected