in reply to Don't-Repeat-Myself code for improvement
or alternatively, sort the items by $somehash ||= -M item into the array and just shift off the first three before doing the rand().# ... my @not_recent = grep !defined( $recent_ids{ $_ } ), @ids; my $idno; { use integer; $idno = (1+$#not_recent) * rand(); } # ...
-M
Free your mind
|
|---|