PHP 8.5.0 Beta 1 available for testing

Voting

: zero plus one?
(Example: nine)

The Note You're Voting On

josh at joshstrike dot com
13 years ago
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.

<< Back to user notes page

To Top