On Fri, Aug 1, 2008 at 2:01 PM, Jim Weirich <jim.weirich / gmail.com> wrote: > On Aug 1, 2008, at 1:53 PM, Thomas Enebo wrote: >> >> I would assume a randomized array based on name. Picking a good name is >> tough. Picking a better name is not so easy. Array.give_me_something > > > What about: > > array.random_choice This would be a suitable analogy to Python's random.choice(array) ... but is almost as long and only slightly more readable than: array[rand(array.length)] (as Thomas suggested). I like the idea of Array#sample with an option argument to specify how many random elements you want. Would arr.sample(3) mean 'pick 3 elements from arr at random' or would it mean 'randomly pick an element from arr 3 times, then give the results'. I think the former could be pretty useful. But maybe this feature just isn't necessary. -greg