From: "Brian Schröder" Date: 2005-12-08T00:12:30+09:00 Subject: Re: Shuffling an array, sort_by{rand}'s bias (was Re: need some Ruby magic) On 07/12/05, hmassa@gmail.com wrote: > Why not > a.dup.sort { 2*rand(12345) <=> 12345 } > > ? that way, we'd have NO colisions ever. > > > What are you all trying to achieve by variations of rand <=> rand, why not simply use rand(3) - 1 ? which is not in danger of decreasing randomness by combining random numbers. cheers, Brian -- http://ruby.brian-schroeder.de/ Stringed instrument chords: http://chordlist.brian-schroeder.de/