Browse files

List.pick shouldn't overwrite the variables it returns (fixes #73)

  • Loading branch information...
1 parent 1b30eff commit dab649965d16e3e4882b71c60ac849b47028af96 @sorear committed Oct 30, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/CORE.setting
View
3 lib/CORE.setting
@@ -295,8 +295,9 @@ my class Any is Mu {
gather {
while ($num > 0 and $number-elements > 0) {
my $idx = floor($number-elements.rand());
- take @l[$idx];
+ my $old = @l[$idx];
@l[$idx] = @l[--$number-elements];
+ take $old;
--$num;
}
}

0 comments on commit dab6499

Please sign in to comment.