breakin a srand usage

This commit is contained in:
tTh 2023-11-14 13:09:27 +01:00
parent 39903d1067
commit 56941f1215

View File

@ -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);
}