mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
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:
parent
208d5ebfd2
commit
af520ccb50
1 changed files with 5 additions and 5 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue