From: Robert Dober Date: 2007-02-12T00:27:03+09:00 Subject: Re: Randomly Sorting Strings ------=_Part_54840_29995952.1171207620933 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 2/11/07, Robert Dober wrote: > > > > On 2/11/07, Stefan Rusterholz wrote: > > > > Sharon Phillips wrote: > > > try > > > > > > example= %w[one two three cat dog cow table] > > > puts example[rand(example.size)] > > > > > > Cheers, > > > Dave > > > > Another example would be: > > > > example= %w[one two three cat dog cow table].sort_by { rand } > > example.each { |string| > > puts string > > } > > > > that will print all in random order > > > > my regards > > > > -- > > Posted via http://www.ruby-forum.com/. > > > > This is not really what you want to do but I cannot post more for now, > this is a Ruby Quiz Spoiler!!! > Robert Ok time to clarify. #sort_by{ rand } is fine, it is my head that is broken, so it is time for me to apologize #sort{ rand } of course is not, but I'll get new reading glasses soon. Robert -- > We have not succeeded in answering all of our questions. > In fact, in some ways, we are more confused than ever. > But we feel we are confused on a higher level and about more important > things. > -Anonymous -- We have not succeeded in answering all of our questions. In fact, in some ways, we are more confused than ever. But we feel we are confused on a higher level and about more important things. -Anonymous ------=_Part_54840_29995952.1171207620933--