On Mon, Mar 24, 2008 at 9:08 PM, Michael Fellinger <m.fellinger / gmail.com> wrote: > On Tue, Mar 25, 2008 at 10:26 AM, Tim Hunter <TimHunter / nc.rr.com> wrote: > > Jimmy Palmer wrote: > > > Tim Hunter wrote: > > >> ~$ irb > > >> irb(main):001:0> (1..13).to_a.sort_by{rand}[0..7] > > >> => [7, 3, 8, 2, 11, 4, 1, 9] > > >> irb(main):002:0> > > > > > > thanks Tim. i like it. > > > > You're welcome. Turns out you don't need the to_a. One less method. > > (1..13).sort_by{ rand }.first(7) > > my attempt to improve upon it :) Tim's shuffle and cut technique seems fishy to me at first, but I like it. Now I'll be up nights reading my old probability texts :) Todd