- microtime: documentation ( source)
- mt_rand: documentation ( source)
- mt_srand: documentation ( source)
- explode: documentation ( source)
<?php
function make_seed()
{
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
mt_srand(make_seed());
$randval = mt_rand()%5000;
?>