On Aug 26, 2007, at 12:31 PM, botp wrote:
> On 8/26/07, Ken Bloom <> wrote:
>> Whoops. As soon as I posted, I noticed that there is no sort_by!.
>
> try
>
> sort!{rand}
That's not a random sort. In fact, it's equivalent to sort! { 1 }:
>> data =3D (0..9).to_a
=3D> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>> data.sort! { rand }
=3D> [9, 5, 0, 6, 2, 7, 4, 8, 3, 1]
>> data.sort! { rand }
=3D> [1, 7, 9, 4, 0, 8, 2, 3, 6, 5]
>> data.sort! { rand }
=3D> [5, 8, 1, 2, 9, 3, 0, 6, 4, 7]
>> data =3D (0..9).to_a
=3D> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>> data.sort! { 1 }
=3D> [9, 5, 0, 6, 2, 7, 4, 8, 3, 1]
>> data.sort! { 1 }
=3D> [1, 7, 9, 4, 0, 8, 2, 3, 6, 5]
>> data.sort! { 1 }
=3D> [5, 8, 1, 2, 9, 3, 0, 6, 4, 7]
It would be better to use:
data =3D data.sort_by { =85 }
James Edward Gray II=