cvs: php4 /ext/standard array.c
| From: | Edin Kadribasic | Date: | Mon, 03 Jun 2002 17:49:49 +0000 |
| Subject: | cvs: php4 /ext/standard array.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-12210@lists.php.net to get a copy of this message | ||
edink Mon Jun 3 13:49:49 2002 EDT
Modified files:
/php4/ext/standard array.c
Log:
Fixed array_rand() on ZTS platforms.
@- Fixed array_rand() on thread-safe platforms such as Windows. (Edin)
Index: php4/ext/standard/array.c
diff -u php4/ext/standard/array.c:1.162 php4/ext/standard/array.c:1.163
--- php4/ext/standard/array.c:1.162 Mon May 13 13:28:38 2002
+++ php4/ext/standard/array.c Mon Jun 3 13:49:48 2002
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.162 2002/05/13 17:28:38 andrei Exp $ */
+/* $Id: array.c,v 1.163 2002/06/03 17:49:48 edink Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -2878,15 +2878,7 @@
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. */