David A. Black wrote:

> I don't think it randomizes very well.
> 
>>> 1000.times { puts "yes!" if [1,2].randomize == [1,2] }
> => 1000 
> David

Well spotted - this is the offending line:

j = Kernel::rand(i)

It means (effectively) that a number can never stay in the same place, 
which breaks the randomness a bit (and totally breaks it for two-element 
arrays).  Changing it to this

j = Kernel::rand(i+1)

seems to fix it.

thanks!
max
-- 
Posted via http://www.ruby-forum.com/.