summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/array.c4
-rw-r--r--ext/standard/php_rand.h3
-rw-r--r--ext/standard/string.c3
3 files changed, 3 insertions, 7 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c
index dfeaef8747..05c89d901b 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2968,7 +2968,7 @@ static void php_array_data_shuffle(zval *array) /* {{{ */
}
}
while (--n_left) {
- RAND_RANGE(rnd_idx, 0, n_left, PHP_RAND_MAX);
+ rnd_idx = php_mt_rand_range(0, n_left);
if (rnd_idx != n_left) {
temp = hash->arData[n_left];
hash->arData[n_left] = hash->arData[rnd_idx];
@@ -2993,7 +2993,7 @@ static void php_array_data_shuffle(zval *array) /* {{{ */
}
}
while (--n_left) {
- RAND_RANGE(rnd_idx, 0, n_left, PHP_RAND_MAX);
+ rnd_idx = php_mt_rand_range(0, n_left);
if (rnd_idx != n_left) {
temp = hash->arData[n_left];
hash->arData[n_left] = hash->arData[rnd_idx];
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
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 1ef96e9132..2526dae144 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -5479,8 +5479,7 @@ static void php_string_shuffle(char *str, zend_long len) /* {{{ */
n_left = n_elems;
while (--n_left) {
- rnd_idx = php_rand();
- RAND_RANGE(rnd_idx, 0, n_left, PHP_RAND_MAX);
+ rnd_idx = php_mt_rand_range(0, n_left);
if (rnd_idx != n_left) {
temp = str[n_left];
str[n_left] = str[rnd_idx];