From: Florian Gross Date: 2004-07-18T19:17:10+09:00 Subject: Re: [NUBY] Ruby Way code for shuffling an array doesn't behave as expected Alexey Verkhovsky wrote: > One example in The Ruby Way claims that in the following snippet second > line shuffles the a (i.e., makes an array consisting of the same > elements as a, but in a different order). By the way, if you just want to shuffle an Array you can also use the much simpler ary.sort_by { rand }. (It will get minimally biased with containers containing millions of elements, but that can be fixed by using Array.new(32) { rand } instead of rand.) > Best regards, > Alexey Verkhovsky More regards, Florian Gross