On Dec 3, 2005, at 9:32 AM, Reinder Verlinde wrote:

> However, there is no guarantee that this call
> will select each of the n! permutations with equal probability.

How about just doing this?

class Array
   def shuffle
     newarr = self
     self.length.times do |x|
       y = rand(self.length)
       newarr[x], newarr[y] = newarr[y], newarr[x]
     end
     newarr
   end
end

shuffled_array = my_array.shuffle

--Steve