C
Charles Comstock
Why doesn't rand take an integer range and then generate a random number
in between the two?
Example:
rand(5..10) -> a random number from 5 to 10 including 10
rand(5...10) -> a random number from 5 to 10 excluding 10
That or maybe add rand to range so it picks a random item out of the
range. For that matter why doesn't Array/Hash have a method to return a
random element?
That way [1,2,4].rand and (5..10).rand would work.
Charles Comstock
in between the two?
Example:
rand(5..10) -> a random number from 5 to 10 including 10
rand(5...10) -> a random number from 5 to 10 excluding 10
That or maybe add rand to range so it picks a random item out of the
range. For that matter why doesn't Array/Hash have a method to return a
random element?
That way [1,2,4].rand and (5..10).rand would work.
Charles Comstock