diff options
author | Tom Van Looy <tom@ctors.net> | 2017-12-03 22:35:50 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2017-12-09 17:24:17 +0100 |
commit | e4e26f24285511c5aa2a359ff7e93c1748fdda3b (patch) | |
tree | b3fa9519b3068603974c99a048d393e98009d2e3 /ext/standard/php_rand.h | |
parent | 6d4de4cf0582cf33848826ab78aae58077dc2dea (diff) | |
download | php-git-e4e26f24285511c5aa2a359ff7e93c1748fdda3b.tar.gz |
Remove RAND_RANGE() macro
The behavior of RANGE_RANGE() is 7.1 changed completely, from
rescaling an already generated number to generating a number
itself. Because of this str_shuffle() ended up generating two
random numbers on every iteration.
To avoid further misuse the function is dropped entirely. Extensions
for PHP >= 7.1 should directly call php_mt_rand_range().
Diffstat (limited to 'ext/standard/php_rand.h')
-rw-r--r-- | ext/standard/php_rand.h | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/ext/standard/php_rand.h b/ext/standard/php_rand.h index b4a6613bee..497a539e4e 100644 --- a/ext/standard/php_rand.h +++ b/ext/standard/php_rand.h @@ -63,9 +63,6 @@ #define RAND_RANGE_BADSCALING(__n, __min, __max, __tmax) \ (__n) = (__min) + (zend_long) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0))) -#define RAND_RANGE(__n, __min, __max, __tmax) \ - (__n) = php_mt_rand_range((__min), (__max)) - #ifdef PHP_WIN32 #define GENERATE_SEED() (((zend_long) (time(0) * GetCurrentProcessId())) ^ ((zend_long) (1000000.0 * php_combined_lcg()))) #else |