in reply to random number generation.

How about you just List::Util shuffle 1 to 15 and then splice the first 5:

#!/usr/bin/perl use Data::Dumper; use List::Util 'shuffle'; my @list = ( 1 .. 15 ); print Dumper( \@list ); my @shuffled = shuffle(@list); print Dumper( \@shuffled ); my @five = splice( @shuffled, 0, 5 ); print Dumper( \@five );

-derby