Re: Question about rand() function
| From: | Hong Zhang | Date: | Wed, 05 Jul 2000 14:27:22 +0000 |
| Subject: | Re: Question about rand() function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-4949@lists.php.net to get a copy of this message | ||
On Wed, 5 Jul 2000, Joseph WENNINGER wrote:
> Is it a change between PHP3 and PHP4 or is it a difference between the Linux
> and the Windows version of PHP, that the the rand() function has only a
> valid range up to 32767 (PHP4 Windows). ?
> The same script I use worked fine with PHP3/Linux with a larger range
> I can't try all possible combinations at the moment.
the code would be more portable if you code the following
$RANGE = 10000;
$rand_num = $RANGE * rand(0,1);
The manual mentioned RAND_MAX which I assume can be set in the source or
php.ini.
HZ
>
> Kind Regards
> Joseph WENNINGER
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
=====================================================
Hong Zhang Sr. System Administrator
Phone: 626-296-5168 Email: zhangh@corp.earthlink.net
=====================================================