From: Ken Bloom Date: 2007-08-27T00:40:03+09:00 Subject: Re: sort_by { rand } not working On Sun, 26 Aug 2007 09:22:38 -0500, Ken Bloom wrote: > On Sun, 26 Aug 2007 22:25:08 +0900, Mike Dershowitz wrote: > >> Hello: >> >> I've got an array of arrays that I'd like to sort_by random. each >> individual array is just a hash of a value and then an object. Is >> there some reason why sort_by { rand } wouldn't work? My code is simple >> (teams is populated with a db call): >> >> @teams.each do |t| >> @all << ["t",t] >> end >> #current not working >> @all.sort_by { rand } > > sort_by returns the sorted list > sort_by! sorts the list in place Whoops. As soon as I posted, I noticed that there is no sort_by!. --Ken -- Ken Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/