]> granicus.if.org Git - php/commitdiff
for the daft folks that think 0 is a good seed.
authorSterling Hughes <sterling@php.net>
Sun, 16 Sep 2001 03:50:04 +0000 (03:50 +0000)
committerSterling Hughes <sterling@php.net>
Sun, 16 Sep 2001 03:50:04 +0000 (03:50 +0000)
ext/standard/rand.c

index 8cde64300b3d873b5019396214f7ed45aca5e7ca..50f09e2e4c90e31c779ae163f358c83c10b63778 100644 (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);