trans. (T. Onoma) schreef:

> Hmm.. Interesting. Do you mind changing version 3 to use a tmp variable, like 
> yours, and see how they compare again?


That's a lot faster, indeed!

 >ruby test3.rb
1.262
0.611
0.33
 >Exit code: 0
 >ruby test3.rb
1.201
0.551
0.321
 >Exit code: 0
 >ruby test3.rb
1.202
0.561
0.32
 >Exit code: 0


   def shuffle3!
     ln = length
     ln.times do |a|
       b = Kernel.rand(ln)
       tmp = self[a]
       self[a] = self[b]
       self[b] = tmp
       #self[a], self[b] = self[b], self[a]
     end
     self
   end