]> granicus.if.org Git - php/commitdiff
Instead of using the poor system rand() algorithm and the
authorSascha Schumann <sas@php.net>
Wed, 18 Jul 2001 22:56:56 +0000 (22:56 +0000)
committerSascha Schumann <sas@php.net>
Wed, 18 Jul 2001 22:56:56 +0000 (22:56 +0000)
system-time seed, rely on the long-living LCG to determine
whether to start the GC process.

ext/session/session.c

index 1248e6e02dd9ed245fb0d2beb23832dacacaf834..f709b6be2bf449e022b404711ce2299a020d4466 100644 (file)
@@ -911,9 +911,8 @@ static void php_session_start(PSLS_D)
        if (PS(mod_data) && PS(gc_probability) > 0) {
                int nrdels = -1;
 
-               srand(time(NULL));
-               nrand = (int) (100.0*rand()/RAND_MAX);
-               if (nrand < PS(gc_probability)) {
+               nrand = (int) (100.0*php_combined_lcg());
+               if (nrand <= PS(gc_probability)) {
                        PS(mod)->gc(&PS(mod_data), PS(gc_maxlifetime), &nrdels);
 #if 0
                        if (nrdels != -1)