Posted By

petrafull on 10/27/09


Versions (?)

Random Number

 / Published in: PHP

  1. <?php
  2. srand(microtime()*1000000);
  3. $random_number= rand(1,100);
  4. ?>

Report this snippet  


RSS Icon Subscribe to comments
Posted By: alexy on February 17, 2010

Or, for a true random number, read from /dev/random or mt_rand() (which is 3 times faster than rand)

You need to login to post a comment.