- microtime: documentation ( source)
- mt_rand: documentation ( source)
- mt_srand: documentation ( source)
- explode: documentation ( source)
<?php
// seed with microseconds
function make_seed()
{
$time = microtime();
echo $time;
echo '<pre>';explode(' ', $time);
list($usec, $sec) = explode(' ', $time);
return (float) $sec + ((float) $usec * 100000);
}
mt_srand(make_seed());
$randval = mt_rand();
echo $randval;