ibanez270dx Posted June 13, 2008 Share Posted June 13, 2008 hello, I need to create a random 10 digit number... I can get a random number with a little snippet I found, but not the fixed length: srand ((double) microtime( )*1000000); $random_number = rand( ); echo "$random_number"; Any suggestions? Thanks, - Jeff Miller Link to comment https://forums.phpfreaks.com/topic/110101-solved-random-number-of-a-fixed-length/ Share on other sites More sharing options...
kenrbnsn Posted June 13, 2008 Share Posted June 13, 2008 You don't need to use <?php srand ((double) microtime( )*1000000); ?> anymore to seed the random number generator. Just use <?php $random_number = rand(1000000000,9999999999); echo $random_number; ?> Ken Link to comment https://forums.phpfreaks.com/topic/110101-solved-random-number-of-a-fixed-length/#findComment-565041 Share on other sites More sharing options...
ibanez270dx Posted June 13, 2008 Author Share Posted June 13, 2008 thanks! Link to comment https://forums.phpfreaks.com/topic/110101-solved-random-number-of-a-fixed-length/#findComment-565045 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.