note 106288 added to function.mt-srand
| From: | josh at joshstrike dot com | Date: | Tue, 25 Oct 2011 13:29:23 +0000 |
| Subject: | note 106288 added to function.mt-srand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184118@lists.php.net to get a copy of this message | ||
mt_srand effectively performs a modulo % 2147483648 on positive integers over 32 bits, but with
negative integers it instead adds 2147483648 to the value it gets.
Seeds with equal results:
2147483649 == 1
2147483648 == 0
2147483647 == -1
-2147483646 == 2
-2147483647 == 1
-2147483648 == 0
Importantly though, seeding with anything less than -2147483648 will always yield the same result as
seeding with zero.
----
Server IP: 69.147.83.197
Probable Submitter: 90.10.61.145
----
Manual Page -- http://www.php.net/manual/en/function.mt-srand.php
Edit -- https://master.php.net/note/edit/106288
Del: integrated -- https://master.php.net/note/delete/106288/integrated
Del: useless -- https://master.php.net/note/delete/106288/useless
Del: bad code -- https://master.php.net/note/delete/106288/bad+code
Del: spam -- https://master.php.net/note/delete/106288/spam
Del: non-english -- https://master.php.net/note/delete/106288/non-english
Del: in docs -- https://master.php.net/note/delete/106288/in+docs
Del: other reasons-- https://master.php.net/note/delete/106288
Reject -- https://master.php.net/note/reject/106288
Search -- https://master.php.net/manage/user-notes.php