ramdom number

how can i create a ramdom number of
8 digits?
mwhuenAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
MindoConnect With a Mentor Commented:
A number from 0 to 99999999 can be generated:

$random = int(rand(99999999));

If you want it to have exactly 8 digits:

$random = 10000000 + int(rand(89999999));
0
 
ozoCommented:
you probably mean
$random = 10000000 + int(rand(90000000));
(although if `perl -V:randbits` < 26 it may not matter much, since most values will be unavailable anyway)
0
All Courses

From novice to tech pro — start learning today.