shadiadiph Posted January 10, 2009 Share Posted January 10, 2009 is there a more logical way to generate a three digit random number than this? <? srand(time()); $random1 = (rand()%9); $random2 = (rand()%9); $random3 = (rand()%9); $mainnumber = "$random1 $random2 $random3"; ?> <? print $mainnumber; ?> Link to comment https://forums.phpfreaks.com/topic/140290-solved-generate-a-three-digit-number/ Share on other sites More sharing options...
RussellReal Posted January 10, 2009 Share Posted January 10, 2009 rand(1,999); ? I suppose Link to comment https://forums.phpfreaks.com/topic/140290-solved-generate-a-three-digit-number/#findComment-734055 Share on other sites More sharing options...
shadiadiph Posted January 10, 2009 Author Share Posted January 10, 2009 mm thanks but that didn't work Link to comment https://forums.phpfreaks.com/topic/140290-solved-generate-a-three-digit-number/#findComment-734056 Share on other sites More sharing options...
Andy-H Posted January 10, 2009 Share Posted January 10, 2009 rand(100,999); Link to comment https://forums.phpfreaks.com/topic/140290-solved-generate-a-three-digit-number/#findComment-734059 Share on other sites More sharing options...
shadiadiph Posted January 10, 2009 Author Share Posted January 10, 2009 seems to work thanks sorry i just thought my way was a bit long winded Link to comment https://forums.phpfreaks.com/topic/140290-solved-generate-a-three-digit-number/#findComment-734063 Share on other sites More sharing options...
Andy-H Posted January 10, 2009 Share Posted January 10, 2009 lol np Link to comment https://forums.phpfreaks.com/topic/140290-solved-generate-a-three-digit-number/#findComment-734064 Share on other sites More sharing options...
RussellReal Posted January 10, 2009 Share Posted January 10, 2009 lol damn andy -.- Link to comment https://forums.phpfreaks.com/topic/140290-solved-generate-a-three-digit-number/#findComment-734084 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.