From: dblack@... Date: 2007-02-11T21:56:59+09:00 Subject: Re: Randomly Sorting Strings Hi -- On Sun, 11 Feb 2007, 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 > } You can replace the last three lines with: puts example :-) David -- Q. What is THE Ruby book for Rails developers? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)