sniper          Sun Jan 18 22:14:59 2004 EDT

  Modified files:              
    /php-src/ext/standard       crypt.c rand.c 
  Log:
  - Moved php_srand() call into php_rand().
  
  # Makes shuffle() and str_shuffle() to be random without having to
  # call srand() in scripts.
  # They don't internally call php_srand() at all and it would be silly
  # to start adding php_srand() calls all over the place..
  
  
Index: php-src/ext/standard/crypt.c
diff -u php-src/ext/standard/crypt.c:1.59 php-src/ext/standard/crypt.c:1.60
--- php-src/ext/standard/crypt.c:1.59   Thu Jan  8 03:17:30 2004
+++ php-src/ext/standard/crypt.c        Sun Jan 18 22:14:58 2004
@@ -17,7 +17,7 @@
    |          Rasmus Lerdorf <[EMAIL PROTECTED]>                             |
    +----------------------------------------------------------------------+
  */
-/* $Id: crypt.c,v 1.59 2004/01/08 08:17:30 andi Exp $ */
+/* $Id: crypt.c,v 1.60 2004/01/19 03:14:58 sniper Exp $ */
 #include <stdlib.h>
 
 #include "php.h"
@@ -119,10 +119,6 @@
        char *str, *salt_in = NULL;
        int str_len, salt_in_len;
 
-       if (!BG(rand_is_seeded)) {
-               php_srand(GENERATE_SEED() TSRMLS_CC);
-       } 
-
        salt[0]=salt[PHP_MAX_SALT_LEN]='\0';
        /* This will produce suitable results if people depend on DES-encryption
           available (passing always 2-character salt). At least for glibc6.1 */
Index: php-src/ext/standard/rand.c
diff -u php-src/ext/standard/rand.c:1.67 php-src/ext/standard/rand.c:1.68
--- php-src/ext/standard/rand.c:1.67    Thu Jan  8 03:17:33 2004
+++ php-src/ext/standard/rand.c Sun Jan 18 22:14:58 2004
@@ -20,7 +20,7 @@
    | Based on code from: Shawn Cokus <[EMAIL PROTECTED]>          |
    +----------------------------------------------------------------------+
  */
-/* $Id: rand.c,v 1.67 2004/01/08 08:17:33 andi Exp $ */
+/* $Id: rand.c,v 1.68 2004/01/19 03:14:58 sniper Exp $ */
 
 #include <stdlib.h>
 
@@ -65,6 +65,10 @@
 {
        long ret;
 
+       if (!BG(rand_is_seeded)) {
+               php_srand(GENERATE_SEED() TSRMLS_CC);
+       }
+
 #ifdef ZTS
        ret = php_rand_r(&BG(rand_seed));
 #else
@@ -323,10 +327,6 @@
        if (argc != 0 && zend_parse_parameters(argc TSRMLS_CC, "ll", &min, &max) == 
FAILURE)
                return;
 
-       if (!BG(rand_is_seeded)) {
-               php_srand(GENERATE_SEED() TSRMLS_CC);
-       }
-
        number = php_rand(TSRMLS_C);
        if (argc == 2) {
                RAND_RANGE(number, min, max, PHP_RAND_MAX);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to