#! perl -slw use strict; for my $i ( 1 .. 100000 ) { my %hash; srand $i; ++$hash{ int rand 100000 } == 2 and print "$i : ", scalar keys %hash while keys %hash < 30; }