From: James Gray Date: 2008-08-03T01:00:35+09:00 Subject: [ruby-core:18084] Re: New array methods cycle, choice, shuffle (plus bug in cycle) On Aug 2, 2008, at 5:15 AM, Yukihiro Matsumoto wrote: > Here are choices: > > * Array#rand (or random, or random_element): pick one random element > from an array. some might confuse the method to behave like > #shuffle though. There's probably not a big chance of random_element() being confused. > * Array#sample: this method can take an optional argument for element > number. Like #first, the method returns an array if an argument is > given. So sample() would return one element, while sample(1) would return a one element Array? I really like that option. James Edward Gray II