FUNCTIONS

unique

set up a generator:

my $id_generator = unique(sub { int rand 1000 });

get a random unique id from this generator:

$id_generator->();