for my $i (0..($n_dice-1)) { $rolls[$i] = int(rand($n_sides))+1; ...