cvs: php4 /ext/standard rand.c

From: Date: Sun, 16 Sep 2001 03:50:05 +0000
Subject: cvs: php4 /ext/standard rand.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-7426@lists.php.net to get a copy of this message
sterling Sat Sep 15 23:50:05 2001 EDT Modified files: /php4/ext/standard rand.c Log: for the daft folks that think 0 is a good seed. Index: php4/ext/standard/rand.c diff -u php4/ext/standard/rand.c:1.51 php4/ext/standard/rand.c:1.52 --- php4/ext/standard/rand.c:1.51 Sat Sep 15 23:46:59 2001 +++ php4/ext/standard/rand.c Sat Sep 15 23:50:04 2001 @@ -20,7 +20,7 @@ | Based on code from: Shawn Cokus <Cokus@math.washington.edu> | +----------------------------------------------------------------------+ */ -/* $Id: rand.c,v 1.51 2001/09/16 03:46:59 sterling Exp $ */ +/* $Id: rand.c,v 1.52 2001/09/16 03:50:04 sterling Exp $ */ #include <stdlib.h> @@ -198,12 +198,12 @@ 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 @@ 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);

« previous php.cvs (#7426) next »