> > What about this... > Or, what would the dangers be? > > class Range > def random > r = self.to_a > r[ rand(r.size) ] > end > end > > (5..10).random yes but what happens when someone says (1..1000000000).random or how about even worse (1.1 .. 2.56).random #<-- this definitely breaks it (infinite set) For integers the best thing for Range would be class Range def pick lower + rand(upper) end end # i'm pretty sure the range is wrong on that but the idea is there But obviously that doesn't work for anything else. The main problem with pick/random over a range is without doing a to_a we actually don't know what the size of the range is, which is potentially pretty bad. Not to mention when it's over a floating range where you get infinite numbers in between technically. So I think what that means is we can add pick to array and hash, as well as pick!, but not to enumerable. For the rand, I still think we should modify it to take a numeric range. Other then that I don't think we can generalize it. Charles Comstock