]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.0'
authorLeigh <leigh@php.net>
Thu, 18 Feb 2016 11:25:15 +0000 (11:25 +0000)
committerLeigh <leigh@php.net>
Thu, 18 Feb 2016 11:25:15 +0000 (11:25 +0000)
* PHP-7.0:
  Revert "Fix #71152: mt_rand() returns the different values from original mt19937ar.c"

`mt_rand()` is seedable with `mt_srand()` which means it can be used to (re)produce specific streams of numbers. All code (no matter how few instances that may be) that previously depended on this behaviour will no longer produce the same results.

This kind of change needs to be discussed before being committed

1  2 
ext/standard/rand.c

index 13b3dcd518a37fe223087d2940592dffd5c6c44b,2dd05e70bba7186bd3b4461b952a6287c824e757..50729f241834e5b9be027999ecaf8709ae932144
@@@ -146,7 -146,7 +146,7 @@@ PHPAPI zend_long php_rand(void
  #define loBits(u)     ((u) & 0x7FFFFFFFU)  /* mask     the highest   bit of u */
  #define mixBits(u, v) (hiBit(u)|loBits(v)) /* move hi bit of u to hi bit of v */
  
- #define twist(m,u,v)  (m ^ (mixBits(u,v)>>1) ^ ((uint32_t)(-(int32_t)(loBit(v))) & 0x9908b0dfU))
 -#define twist(m,u,v)  (m ^ (mixBits(u,v)>>1) ^ ((php_uint32)(-(php_int32)(loBit(u))) & 0x9908b0dfU))
++#define twist(m,u,v)  (m ^ (mixBits(u,v)>>1) ^ ((uint32_t)(-(int32_t)(loBit(u))) & 0x9908b0dfU))
  
  /* {{{ php_mt_initialize
   */