diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2024-03-10 15:49:25 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2024-03-10 23:21:10 -0700 |
commit | f60ce91139b52f8cc19714137a02b6cbd16fa07c (patch) | |
tree | 8c915765843fc83b4504269bbea6e6653fa824b6 | |
parent | 4a5e3e7d255f3f8eba9ecdb8bd8080db43bf0aeb (diff) | |
download | zlib-f60ce91139b52f8cc19714137a02b6cbd16fa07c.tar.gz zlib-f60ce91139b52f8cc19714137a02b6cbd16fa07c.tar.bz2 zlib-f60ce91139b52f8cc19714137a02b6cbd16fa07c.zip |
Improve random number seeding in skipset.h.
-rw-r--r-- | contrib/minizip/skipset.h | 3 |
1 files changed, 2 insertions, 1 deletions
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) { | |||
231 | set_grow(set, set->head, 1, 1); // one link back to head for an empty set | 231 | set_grow(set, set->head, 1, 1); // one link back to head for an empty set |
232 | *(unsigned char *)&set->head->key = 137; // set id | 232 | *(unsigned char *)&set->head->key = 137; // set id |
233 | set->depth = 0; | 233 | set->depth = 0; |
234 | set_seed(&set->gen, (uint64_t)time(NULL) * (uint64_t)clock(), 0); | 234 | set_seed(&set->gen, ((uint64_t)set << 32) ^ |
235 | ((uint64_t)time(NULL) << 12) ^ clock(), 0); | ||
235 | set->ran = 1; | 236 | set->ran = 1; |
236 | } | 237 | } |
237 | 238 | ||