php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch rand-range-double for *Math Functions Bug #63174

Patch version 2015-07-15 22:32 UTC

Return to Bug #63174 | Download this patch
Patch Revisions:

Developer: cmb@php.net

 ext/standard/php_rand.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ext/standard/php_rand.h b/ext/standard/php_rand.h
index 921a605..7a69209 100644
--- a/ext/standard/php_rand.h
+++ b/ext/standard/php_rand.h
@@ -42,7 +42,7 @@
 #endif
 
 #define RAND_RANGE(__n, __min, __max, __tmax) \
-    (__n) = (__min) + (zend_long) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0)))
+    (__n) = (zend_long) (__min) + ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / ((__tmax) + 1.0)))
 
 /* MT Rand */
 #define PHP_MT_RAND_MAX ((zend_long) (0x7FFFFFFF)) /* (1<<31) - 1 */
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 10:01:28 2024 UTC