summaryrefslogtreecommitdiff
path: root/pod/perlfaq4.pod
diff options
context:
space:
mode:
authorIlmari Karonen <iltzu@sci.fi>2001-09-12 02:31:25 +0300
committerAbhijit Menon-Sen <ams@wiw.org>2001-09-12 01:13:49 +0000
commit8caf10e04806e201590b4a28a78a0ad3f0df5851 (patch)
treeb42fbc1e40e03bf52d88413a497fcea99b6bcfa5 /pod/perlfaq4.pod
parentd7f9a270c0cae44e238f7120d767aa2913947b75 (diff)
downloadperl-8caf10e04806e201590b4a28a78a0ad3f0df5851.tar.gz
Deobfuscate Fisher-Yates example code
Message-Id: <Pine.SOL.3.96.1010911231925.688A-100000@simpukka> p4raw-id: //depot/perl@12004
Diffstat (limited to 'pod/perlfaq4.pod')
-rw-r--r--pod/perlfaq4.pod4
1 files changed, 2 insertions, 2 deletions
diff --git a/pod/perlfaq4.pod b/pod/perlfaq4.pod
index 7dcb881a46..bf24254529 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];
}