From:             jullrich at sans dot org
Operating system: Linux 2.6 (RedHat)
PHP version:      4.4.1
PHP Bug Type:     *Math Functions
Bug description:  The 'rand()' function returns only few different values

Description:
------------
The 'rand' function is far from random. For example, the
following code:

<?= rand(10000000000,99999999999); ?>

only generates values that start with '12','13' or '14'.
Out of 1500 times the function is called, only approx. 1000 different
values are generated.






Reproduce code:
---------------
<?= rand(10000000000,99999999999); ?>

Expected result:
----------------
somewhat random numbers between 10000000000 and 99999999999.


Actual result:
--------------
all numbers are in the range from 120000000000 to 150000000000 and
frequently repeat (about 25% of the numbers
are repeats).

Sample:

1379409636
1275750426
1248288483
1398136354
1404047798
1292410973
1405794269
1278267510
1225653649
 

-- 
Edit bug report at http://bugs.php.net/?id=35662&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=35662&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=35662&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=35662&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35662&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=35662&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35662&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35662&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35662&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35662&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35662&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=35662&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=35662&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35662&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35662&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35662&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35662&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35662&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35662&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35662&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35662&r=mysqlcfg

Reply via email to