sub pick_one { my($from,$to) = @_; for(my $i=$from;$i<=$to;$i++) { return $i if(rand(1) <= 1/($to-$i+1)); } }