Mauricio Fernández
1/3/2006 12:12:00 PM
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