note 19244 added to function.mt-srand
| From: | changminyang at hananet dot net | Date: | Wed, 20 Feb 2002 19:00:02 +0000 |
| Subject: | note 19244 added to function.mt-srand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26860@lists.php.net to get a copy of this message | ||
list($usec,$sec) = explode(" ",microtime());
/* Test: Each get rand sequence are 10time. */
/* ex) 5.3point meaning 5point integer + 3point decimal */
// case A:
// 5.0point - 1time
// 6.0point - 9time
$rand = (double)microtime()*1000000;
// case B:
// 8.6point - 1time
// 9.4point - 1time
// 9.5point - 7time
// 10.3point - 1time
$rand = (double)$sec * $usec;
// My case A:
// 8.0point - 10time
$rand = explode(".",$usec * $sec);
$rand = (double)substr($rand[0]*$rand[1],0,8);
// My case B:
// 9.0point - 9time
// 10.0point - 1time
$rand = explode(".",$usec * $sec);
$rand = $rand[0] + $rand[1];
mt_srand($rand);
srand($rand);
// P.S> My previous note is has wrong lines, sorry about it. This is right.
--
http://www.php.net/manual/en/function.mt-srand.php
http://master.php.net/manage/user-notes.php?action=edit+19244
http://master.php.net/manage/user-notes.php?action=delete+19244
http://master.php.net/manage/user-notes.php?action=reject+19244