Stefan Arentz wrote:

>Here is another small Ruby code snippet that extends the Array class. Use
>this to randomize the order of all entries in an Array.
>
> class Array
>   def shuffle
>     self.each_index { |i| r = rand(self.length - 1);
>         self[i],self[r] = self[r],self[i] }
>   end
> end
>
>Works like this:
>
> a = Array[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
> a.shuffle
>   ==> [7, 10, 9, 6, 4, 8, 5, 3, 1, 2]
>
>S.
>
>  
>
This seems like a relevant discussion:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/19125

Chad