From: a0 at hush dot com
Operating system: solaris 8
PHP version: 4.3.2
PHP Bug Type: Math related
Bug description: rand function with range always returns low value of range

when using the rand function with php 4.3.2 on solaris 8, it will
return a random value as expected if no range is specified. if a range
is specified it will always return the low value of the range.

i'm building the module with -DZTS, and it is being loaded into

i've modified the code so it works by changing line 36 of
php_rand.h from
#if (HAVE_LRAND48 && !sun)
so PHP_RAND_MAX will get a value of RAND_MAX.

Reproduce code:
$r = rand();
echo "$r\n";
$r = rand(0, 100);
echo "$r\n";

Expected result:

(it will always return 0)

Edit bug report at [url][/url]
Try a CVS snapshot (php4): [url][/url]
Try a CVS snapshot (php5): [url][/url]
Fixed in CVS: [url][/url]
Fixed in release: [url][/url]
Need backtrace: [url][/url]
Try newer version: [url][/url]
Not developer issue: [url][/url]
Expected behavior: [url][/url]
Not enough info: [url][/url]
Submitted twice: [url][/url]
register_globals: [url][/url]
PHP 3 support discontinued: [url][/url]
Daylight Savings: [url][/url]
IIS Stability: [url][/url]
Install GNU Sed: [url][/url]