From: Mauricio Fernandez Date: 2006-01-03T21:12:09+09:00 Subject: Re: sort_by{rand} doesn't shuffle array On Tue, Jan 03, 2006 at 08:54:33PM +0900, Devin Mullins wrote: > Mauricio Fernandez wrote: > > >On Tue, Jan 03, 2006 at 07:03:42PM +0900, Pat Maddox wrote: > > > > > >> def shuffle! > >> @my_array.sort_by{rand} > >> > >> > > @my_array = @my_array.sort_by{rand} > > > > > or @my_array.sort_by! { rand } RUBY_RELEASE_DATE # => "2005-12-24" RUBY_VERSION # => "1.8.4" %w[a b c d].sort_by!{rand} # => # ~> -:3: undefined method `sort_by!' for ["a", "b", "c", "d"]:Array (NoMethodError) -- Mauricio Fernandez