- or download this
sub pick {
my( $total, @weights ) = @_;
...
and return $_
for 0 .. $#weights;
}
- or download this
#! perl -slw
use strict;
...
$stats[ $_ ] *100 / $REPS;
}
print sum( @stats ) *100 / $REPS, '%' ;
- or download this
C:\test>junk6 -SHIPS=4 -REPS=1e5
0: Expected: 16.519% Actual: 16.604%
...
0: Expected: 56.789% Actual: 55.000%
1: Expected: 43.211% Actual: 45.000%
100%