my $number_of_positions = 10; my @positions = (1..200); for my $i (1..$number_of_positions) { $arry[splice(@positions, rand(@positions), 1)] = 15; }