- or download this
my %bias = (1 => 1, 2 => 1);
- or download this
$rand = $k if rand($sum += $v) <= $v;
# This simplifies to:
# $rand = 1 if rand(1) <= 1
# this is always true. That's wrong.
- or download this
my $sum = 0;
$sum += $_ foreach (values %bias);
...
last;
}
}