From: Max Williams Date: 2008-07-04T00:57:40+09:00 Subject: Re: pseudo-randomize an array in a consistent order Thanks guys This is what i did in the meantime since asking (I monkey-patched Array): class Array def randomize(seed=nil) srand(seed) if seed self.sort{|a,b| rand <=> rand } end def randomize!(seed=nil) srand(seed) if seed self.sort!{|a,b| rand <=> rand } end end I'm worried though that using sort like this is a bit inefficient. The array being sorted is around 3000 numbers (and not likely to exceed 5000) so maybe that's not too much of an issue. Is there a more efficient way you can think of? -- Posted via http://www.ruby-forum.com/.