open System
let random_number_generator = System.Random(int System.DateTime.Now.Ticks) in
let random_number_below n = random_number_generator.Next(n) in
match random_number_below 3 with
| 0 -> "Zero!"
| 1 -> "One!"
| 2 -> "Two!"
;;
The above match statement is not exhaustive, according to the compiler. This is totally legitimate, as F# has no syntactical information that would guarantee the bounds of the random number.
Incomplete pattern matches on this expression. For example, the value '3' may indicate a case not covered by the pattern(s).
What were the idiomatic F# way of matching (or is it simply if-else’ing) against a random number?
As in the comments, solving this in general requires solving the halting problem. As a result the best thing to do is probably