From: Ilmari Karonen Date: Tue, 11 Sep 2001 23:31:25 +0000 (+0300) Subject: Deobfuscate Fisher-Yates example code X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8caf10e04806e201590b4a28a78a0ad3f0df5851;p=p5sagit%2Fp5-mst-13.2.git Deobfuscate Fisher-Yates example code Message-Id: p4raw-id: //depot/perl@12004 --- diff --git a/pod/perlfaq4.pod b/pod/perlfaq4.pod index 7dcb881..bf24254 100644 --- a/pod/perlfaq4.pod +++ b/pod/perlfaq4.pod @@ -1211,8 +1211,8 @@ If not, you can use this: # generate a random permutation of @array in place sub fisher_yates_shuffle { my $array = shift; - my $i; - for ($i = @$array; --$i; ) { + my $i = @$array; + while (--$i) { my $j = int rand ($i+1); @$array[$i,$j] = @$array[$j,$i]; }