Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


Php Programming Code Examples

Php > Algorithms Code Examples

Random digit

Random digit <?php function randomdigit($digits) { static $startseed = 0; if (!$startseed) { $startseed = (double)microtime()*getrandmax(); srand($startseed); } $range = 8; $start = 1; $i = 1; while ($i<$digits) { $range = $range . 9; $start = $start . 0; $i++; } return (rand()%$range+$start); } ?>