http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5599





------- Additional Comments From [EMAIL PROTECTED]  2007-09-13 05:15 -------
This shuffle can fall in a loop if array is empty:

  my $i = @$deck;
  while (--$i) {
    my $j = int rand ($i+1);
    @$deck[$i,$j] = @$deck[$j,$i];
  }

I find the following cleaner and deals with empty array too:

  for (my $i = $#$deck; $i >= 0; $i--) {
    my $j = int rand($i+1);
    @$deck[$i,$j] = @$deck[$j,$i];
  }



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Reply via email to