Improve random number seeding in skipset.h.

This commit is contained in:
Mark Adler 2024-03-10 15:49:25 -07:00
parent 4a5e3e7d25
commit f60ce91139
1 changed files with 2 additions and 1 deletions

View File

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