> sterling Wed Sep  5 16:52:45 2001 EDT
>
>   Modified files:
>     /php4/ext/standard rand.c
>   Log:
>   a bit of api cleanup...  move range stuff into a macro (properly :)

Yeah yeah... I know by now...

> +#define RAND_RANGE(__n, __min, __max) \
> + (__min) + (int)((double)(__max) - (__min) + 1.0) * ((__n) /
(PHP_RAND_MAX + 1.0))
> +

[in PHP_FUNCTION(rand)]

> + number = RAND_RANGE(number, Z_LVAL_PP(min), Z_LVAL_PP(max));
>   }

[in PHP_FUNCTION(mt_rand)]

> + number = RAND_RANGE(number, Z_LVAL_PP(min), Z_LVAL_PP(max));
>   }

PHP_RAND_MAX is only valid for rand, not for mt_rand. mt_rand has
MT_RAND_MAX, which
could be different (not on most common builds, but on some platforms it is).

--Jeroen


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to