Minor fix to the *srand make_seed() function

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@60012 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Zak Greant 2001-10-15 22:51:36 +00:00
parent 208d5ebfd2
commit af520ccb50

View file

@ -1,5 +1,5 @@
<?xml encoding="iso-8859-1"?>
<!-- $Revision: 1.54 $ -->
<!-- $Revision: 1.55 $ -->
<reference id="ref.math">
<title>Mathematical Functions</title>
<titleabbrev>Math</titleabbrev>
@ -796,8 +796,8 @@ var_dump(hexdec("a0"));
<programlisting role="php">
// seed with microseconds
function make_seed() {
list($usec,$sec) = explode(" ", microtime());
return ((float)$sec+(float)$usec) * 100000;
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
mt_srand(make_seed());
$randval = mt_rand();
@ -1229,8 +1229,8 @@ $foo = round(1241757, -3); // $foo == 1242000
<programlisting role="php">
// seed with microseconds
function make_seed() {
list($usec,$sec) = explode(" ", microtime());
return ((float)$sec+(float)$usec) * 100000;
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
srand(make_seed());
$randval = rand();