1
0
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:
Sterling Hughes
2001-09-16 03:50:04 +00:00
parent 373fc12bb1
commit 47f3851a00

View File

@@ -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);