From f0c5631778393d357d00551307b93546709c1f1f Mon Sep 17 00:00:00 2001 From: Sterling Hughes Date: Wed, 5 Sep 2001 20:59:24 +0000 Subject: change range macro semantics # Kinda torn between the two, thoughts? --- ext/standard/rand.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ext/standard/rand.c') diff --git a/ext/standard/rand.c b/ext/standard/rand.c index 243376c4b7..e71692d169 100644 --- a/ext/standard/rand.c +++ b/ext/standard/rand.c @@ -249,7 +249,7 @@ PHP_FUNCTION(mt_srand) * -RL */ #define RAND_RANGE(__n, __min, __max) \ - (__min) + (int)((double)(__max) - (__min) + 1.0) * ((__n) / (PHP_RAND_MAX + 1.0)) + (__n) = (__min) + (int)((double)(__max) - (__min) + 1.0) * ((__n) / (PHP_RAND_MAX + 1.0)) /* {{{ proto int rand([int min, int max]) Returns a random number */ @@ -267,7 +267,7 @@ PHP_FUNCTION(rand) number = php_rand(); if (argc == 2) { - number = RAND_RANGE(number, Z_LVAL_PP(min), Z_LVAL_PP(max)); + RAND_RANGE(number, Z_LVAL_PP(min), Z_LVAL_PP(max)); } RETURN_LONG(number); @@ -298,7 +298,7 @@ PHP_FUNCTION(mt_rand) */ number = (long) (randomMT(TSRMLS_C) >> 1); if (argc == 2) { - number = RAND_RANGE(number, Z_LVAL_PP(min), Z_LVAL_PP(max)); + RAND_RANGE(number, Z_LVAL_PP(min), Z_LVAL_PP(max)); } RETURN_LONG(number); -- cgit v1.2.1