> > Charles, > > We were talking about this in IRC. Maybe you were one of those? :) > > Someone suggested allowing not just rand(Fixnum) and rand(Range) > but in general rand(Enumerable). > > Someone else said: That's kind of "overloading" the meaning of rand. > Well, I can see that might not be appropriate. > > I think if it were my decision, I'd do something like: > > 1. Let rand accept a (numeric) Range, since rand is already a numeric > kind of thing. > 2. Add pick to Enumerable to pick a random element. (See #3) > 3. Add pick! also, to do a pick with deletion. (rand! is not an > intuitive name) > > Comments? > > Hal > > Well I wasn't in the IRC channel, it gets filtered on my connection, but I am glad others have thought of using rand in that fashion. I think those 3 systems make logical sense. I would have the pick command have some argument to choose what sort of distribution though, defaulting to uniform distribution. Not sure if it makes more sense to specify these as constants or as passed blocks or something. I would be worried about the use of pick though on some things though. Also how would you notate that pick! had removed an item from a range? It makes sense for sets, arrays, hashes, but does it make sense for a numeric range? Definitely have pick for Enumerable, but pick! may have some issues. Charles Comstock