mirror of
https://github.com/php/php-src.git
synced 2026-04-09 17:13:31 +02:00
for the daft folks that think 0 is a good seed.
This commit is contained in:
@@ -198,12 +198,12 @@ PHPAPI php_uint32 php_mt_rand(TSRMLS_D)
|
||||
Seeds random number generator */
|
||||
PHP_FUNCTION(srand)
|
||||
{
|
||||
long seed = 0;
|
||||
long seed;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &seed) == FAILURE)
|
||||
return;
|
||||
|
||||
if (!seed)
|
||||
if (ZEND_NUM_ARGS() == 0)
|
||||
seed = GENERATE_SEED();
|
||||
|
||||
php_srand(seed);
|
||||
@@ -214,12 +214,12 @@ PHP_FUNCTION(srand)
|
||||
Seeds Mersenne Twister random number generator */
|
||||
PHP_FUNCTION(mt_srand)
|
||||
{
|
||||
long seed = 0;
|
||||
long seed;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &seed) == FAILURE)
|
||||
return;
|
||||
|
||||
if (!seed)
|
||||
if (ZEND_NUM_ARGS() == 0)
|
||||
seed = GENERATE_SEED();
|
||||
|
||||
php_mt_srand(seed TSRMLS_CC);
|
||||
|
||||
Reference in New Issue
Block a user