Group: comp.lang.ruby
From: 7stud --
Date: Sunday, February 17, 2008 5:12 PM
Subject: Re: Randomising

Robert Klemme wrote:
> On 17.02.2008 15:10, 7stud -- wrote:
>
>> quiz_names = ['a', 'b', 'c', 'd', 'e']
>>
>> random_names = quiz_names.sort_by {|quiz_name| rand(0)}
>
> You do not need the block parameter.
>

I know. I also don't need the parameter for rand(). However, both make
the code easier to follow--especially for someone new.
--
Posted via http://www.ruby-forum.com/.

Safety Articles | Usenet Groups | 20lbs in 30 days