Skip to content

Commit

Permalink
Improve random number seeding in skipset.h.
Browse files Browse the repository at this point in the history
  • Loading branch information
madler committed Mar 11, 2024
1 parent 4a5e3e7 commit f60ce91
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contrib/minizip/skipset.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit f60ce91

Please sign in to comment.