[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: sorting by rand?

seebs

4/30/2007 6:40:00 AM

In message <46358854.30705@cesmail.net>, "M. Edward (Ed) Borasky" writes:
>Welll ... I do this in Excel all the time -- add a column of random
>numbers to the right of the (CSV) file I want to shuffle, sort it about
>five times, hitting F9 before each sort to change the random numbers,
>and then deleting the random column and saving the file. Translate that
>to Ruby and I think you've got it.

It seems expensive.

-s

1 Answer

Alex Young

4/30/2007 7:03:00 AM

0

Peter Seebach wrote:
> In message <46358854.30705@cesmail.net>, "M. Edward (Ed) Borasky" writes:
>> Welll ... I do this in Excel all the time -- add a column of random
>> numbers to the right of the (CSV) file I want to shuffle, sort it about
>> five times, hitting F9 before each sort to change the random numbers,
>> and then deleting the random column and saving the file. Translate that
>> to Ruby and I think you've got it.
>
> It seems expensive.

That's almost exactly what sort_by{rand} does...

--
Alex