Apparently avoiding the swapping is too costly.
Ben Tilly [Fri, 1 Sep 2000 20:23:16 +0000 (16:23 -0400)]
Subject: Re: the door is closed.
Message-ID: <LAW2-F2963JkUwWpSWe00000904@hotmail.com>

p4raw-id: //depot/perl@7004

pod/perlfaq4.pod

index 112b1ed..79905f8 100644 (file)
@@ -1189,7 +1189,6 @@ Use this:
         my $i;
         for ($i = @$array; --$i; ) {
             my $j = int rand ($i+1);
-            next if $i == $j;
             @$array[$i,$j] = @$array[$j,$i];
         }
     }