From: Conrad Schneiker Date: 2000-07-04T18:03:44-05:00 Subject: [ruby-talk:03808] Re: Array.pick Hi, "Aleksi Niemel" wrote > I've found following snippet quite handy. Dunno if there's wider need for > this. > > class Array > def pick( count = -1 ) > if count >= 0 > ary = [] > count.times do > ary << self.delete_at( rand( self.length ) ) > end > return ary > end > self.delete_at( rand( self.length ) ) > end > end Just a general comment--a brief statement of purpose and using conventional indentation would be helpful. Apart from what should be the unnecessary work of trying to figure out what was intended from the code, one still never really knows for the author's original intent and how well the code actually matches it. Conrad