pollita         Tue Aug 12 20:49:22 2003 EDT

  Modified files:              
    /php-src/ext/standard       php_rand.h 
  Log:
  Prevent carryover when max-min > signed int max
  
Index: php-src/ext/standard/php_rand.h
diff -u php-src/ext/standard/php_rand.h:1.23 php-src/ext/standard/php_rand.h:1.24
--- php-src/ext/standard/php_rand.h:1.23        Sun Aug 10 20:42:29 2003
+++ php-src/ext/standard/php_rand.h     Tue Aug 12 20:49:22 2003
@@ -20,7 +20,7 @@
    | Based on code from: Shawn Cokus <[EMAIL PROTECTED]>          |
    +----------------------------------------------------------------------+
  */
-/* $Id: php_rand.h,v 1.23 2003/08/11 00:42:29 sniper Exp $ */
+/* $Id: php_rand.h,v 1.24 2003/08/13 00:49:22 pollita Exp $ */
 
 #ifndef PHP_RAND_H
 #define        PHP_RAND_H
@@ -40,7 +40,7 @@
 #endif
 
 #define RAND_RANGE(__n, __min, __max, __tmax) \
-    (__n) = (__min) + (long) ((double) ((__max) - (__min) + 1.0) * ((__n) / ((__tmax) 
+ 1.0)))
+    (__n) = (__min) + (long) ((double) ( (double) (__max) - (__min) + 1.0) * ((__n) / 
((__tmax) + 1.0)))
 
 /* MT Rand */
 #define PHP_MT_RAND_MAX ((long) (0x7FFFFFFF)) /* (1<<31) - 1 */ 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to