{ my @dist = ( (0) x 20, (1) x 25, (2) x 72, (3) x 40 ); sub choose_weighted { $dist[ rand(@dist)]; } }