Help for this page

Select Code to Download


  1. or download this
    sub pick {
        my( $total, @weights ) = @_;
    ...
            and return $_ 
            for 0 .. $#weights;
    }
    
  2. or download this
    #! perl -slw
    use strict;
    ...
            $stats[ $_ ] *100 / $REPS;
    }
    print sum( @stats ) *100 / $REPS, '%' ;
    
  3. 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%