From: Michael Fellinger Date: 2008-03-25T11:08:46+09:00 Subject: Re: generating unique random numbers On Tue, Mar 25, 2008 at 10:26 AM, Tim Hunter 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 :)