From cbcb6e1936bcb62d7ba930cf1474a88d07427aff Mon Sep 17 00:00:00 2001 From: Edin Kadribasic Date: Mon, 3 Jun 2002 17:57:41 +0000 Subject: [PATCH] MFH --- NEWS | 1 + ext/standard/array.c | 10 +--------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 97635947cd..cf187c7552 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ PHP 4 NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2002, Version 4.2.2 +- Fixed array_rand() on thread-safe platforms such as Windows. (Edin) - Report the right exit code after a call to exit(). (Edin) 13 May 2002, Version 4.2.1 diff --git a/ext/standard/array.c b/ext/standard/array.c index 3b010c31ac..681689c77f 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -2880,15 +2880,7 @@ PHP_FUNCTION(array_rand) zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos); while (num_req_val && (key_type = zend_hash_get_current_key_ex(Z_ARRVAL_PP(input), &string_key, &string_key_len, &num_key, 0, &pos)) != HASH_KEY_NON_EXISTANT) { -#ifdef HAVE_RANDOM - randval = random(); -#else -#ifdef HAVE_LRAND48 - randval = lrand48(); -#else - randval = rand(); -#endif -#endif + randval = php_rand(TSRMLS_C); if ((double)(randval/(PHP_RAND_MAX+1.0)) < (double)num_req_val/(double)num_avail) { /* If we are returning a single result, just do it. */ -- 2.50.1