| Home > Computer & I'net > Numbers - Random... |
Numbers - Random | |
<?php srand ((double) microtime( )*1000000); $random_number = rand( ); echo "$random_number"; ?> 746666320 The value in the srand command is a number mixer, which is then passed into the actual rand command. To make a random number within a specific range, you can add the number range in the rand command brackets. This example will find a number between 0 and 10: <?php srand ((double) microtime( )*1000000); $random_number = rand(0,10); echo "$random_number"; ?> 10
----------------- Article by David Stanley. Visit his site http://www.htmlite.com. Reprinted with permission. | |
| Articles |
•Auto & Trucks•Business•Computer & I'net·General·Apache·CSS·Database·Hardware·HTML·Javascript&DHTML·Linux·MySQL·Operating System·Perl / CGIPHP·Programming·Publishing·Search Engines·Software Problems·SSI·Tips & Tricks·Utilities·Web Design•Family•Food & Drink•Gardening•Health•Other•Pets•Psychology•Spiritual•Travel•Women |
| Calculators |
|