From: Sascha Schumann Date: Wed, 18 Jul 2001 22:56:56 +0000 (+0000) Subject: Instead of using the poor system rand() algorithm and the X-Git-Tag: PRE_TSRM_MERGE_PATCH~85 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9576ab24dd1e21ef674f8d6b95de5055b3f8e1f9;p=php Instead of using the poor system rand() algorithm and the system-time seed, rely on the long-living LCG to determine whether to start the GC process. --- diff --git a/ext/session/session.c b/ext/session/session.c index 1248e6e02d..f709b6be2b 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -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)