PHP 4.0 Bug #7281: rand() gives range warnings over 15 bits

From: Date: Tue, 17 Oct 2000 15:26:31 +0000
Subject: PHP 4.0 Bug #7281: rand() gives range warnings over 15 bits
Groups: php.dev 
Request: Send a blank email to php-dev+get-35267@lists.php.net to get a copy of this message
From: a.schommer@dialogmedien.de Operating system: Solaris 2.7 PHP version: 4.0.2 PHP Bug Type: Math related Bug description: rand() gives range warnings over 15 bits rand() should work on int, which is about 2 billion. But i get Warning: rand(): Invalid range: 1000000..1032768 in /tmp/apa2/htdocs/admin/tst.php3 on line 1 For this code: <? print rand (1000000, 1032768); ?> (a result is given anyway) Not the size, but the difference seems to matter: If it exceeds 2^15-1, the warning comes up: <? print rand (1000000, 1032767); ?> produces only a result sizeof(int) really is 4. So i don't think it's my fault. -- Edit Bug report at: http://bugs.php.net/?id=7281&edit=1

« previous php.dev (#35267) next »