Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: random num generator

by barrd (Canon)
on Jan 20, 2004 at 12:59 UTC ( [id://322574] : note . print w/replies, xml ) Need Help??


in reply to random num generator

Hi florrie,
Heres how I do it, you will probably get other suggestions too...

sub generateRandomNumber { my $len = shift || 12; my @chars = (0..9); return join '', map { $chars[ rand @chars ] } 1..$len; }