From 56941f12153efb30e8177ae11bc15d286e63680e Mon Sep 17 00:00:00 2001 From: tTh Date: Tue, 14 Nov 2023 13:09:27 +0100 Subject: [PATCH] breakin a srand usage --- Tools/fonctions.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Tools/fonctions.c b/Tools/fonctions.c index c9d2b53..b3d38d6 100644 --- a/Tools/fonctions.c +++ b/Tools/fonctions.c @@ -450,13 +450,9 @@ int set_new_seed(int k) char *ptr; long seed; -#if DEBUG_MESSAGE -if (k) fprintf(stderr, "%s: k %d\n", __func__, k); -#endif - if (NULL==(ptr=getenv("FIXED_SEED"))) { /* no fixed seed in context, doing semi-random */ - srand(getpid()); + srand(getpid() + k); #if DEBUG_LEVEL fprintf(stderr, "no FIXED_SEED, first rand is number : %d\n", rand()); #endif @@ -464,10 +460,6 @@ if (NULL==(ptr=getenv("FIXED_SEED"))) { else { /* try to parse the env var */ seed = strtol(ptr, NULL, 0); -#if DEBUG_LEVEL - fprintf(stderr, "%s : strtol(%s) -> %ld\n", - __func__, ptr, seed); -#endif srand(seed); }