From: Kero van Gelder Date: 2001-10-09T06:28:20+09:00 Subject: [ruby-talk:22264] Re: [Newbie] Switching from Perl : suffling > > How about something like > > > > class Array > > def shuffle > > each_index {|i| o = rand(size); self[i], self[o] = self[o], self[i] } > > end > > end > > That code in fact results in a slightly biased shuffle. The easiest > way to realize that is probably this: This biased one seems to pop up everywhere again and again :) Be aware! +--- Kero ------------------------------ kero@chello.nl ---+ | Don't split your mentality without thinking twice | | Proud like a God -- Guano Apes | +--- M38c ------- http://members.chello.nl/~k.vangelder ---+