From f60ce91139b52f8cc19714137a02b6cbd16fa07c Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Sun, 10 Mar 2024 15:49:25 -0700 Subject: [PATCH] Improve random number seeding in skipset.h. --- contrib/minizip/skipset.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/minizip/skipset.h b/contrib/minizip/skipset.h index f829b18..019b88d 100644 --- a/contrib/minizip/skipset.h +++ b/contrib/minizip/skipset.h @@ -231,7 +231,8 @@ void set_start(set_t *set) { set_grow(set, set->head, 1, 1); // one link back to head for an empty set *(unsigned char *)&set->head->key = 137; // set id set->depth = 0; - set_seed(&set->gen, (uint64_t)time(NULL) * (uint64_t)clock(), 0); + set_seed(&set->gen, ((uint64_t)set << 32) ^ + ((uint64_t)time(NULL) << 12) ^ clock(), 0); set->ran = 1; }