Open FooB4r opened 6 years ago
OK, sounds like the right thing to do is to replace:
val range : int -> int gen
with
val range : ?min:int -> lim:int -> int gen
so that
range 10
range ~lim:10
range ~min:5 ~lim:10
all work.
I'm not quite sure what the second argument should be called. range
uses half-open intervals (exclusive of the upper bound), so max
is the wrong word.
You can either name it ubound
(which is the mathematical term for [min; ubound[
)
Another solution is to have n
as in "n elements" which is more computer science and range min n
would give [min; min+n[
val range : ?min:int -> n:int -> int gen
When generating characters from their ASCII code if we want every char except the controls chars
Controls char: from 0 to 31 and 127
Non controls char:
I suggest instead:
Same for alphanumeric, and all sets of contiguous values in ASCII.