From: seebs@... (Peter Seebach) Date: 2007-04-30T11:01:25+09:00 Subject: sorting by rand? Browsing something at a bookstore recently, I saw an example of an array shuffle allegedly implemented with x.sort { rand } or something to that effect. This seems sort of unlikely, to me, to be a correct shuffling algorithm. I'm not even sure it's safe at all. I know that doing the same thing to C qsort implementations occasionally causes one to blow up spectacularly, because its assumption that the comparison between any two items is constant gets broken. So, two vaguely related questions: 1. Is there a reasonably sane way to do this, should I ever find myself wanting one? 2. Am I right in guessing that handing garbage to Array#sort is probably crazy? -s