Skip to content

Fix initialization of tabulation hash #7144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions include/util/xor_fast_hash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@ template <std::size_t MaxNumElements = (1u << 16u)> class XORFastHash
public:
XORFastHash()
{
std::mt19937 generator(1); // impl. defined but deterministic default seed
std::mt19937 generator(0xdeadbeef);
std::uniform_int_distribution<> distrib(0, UINT16_MAX);

std::iota(begin(table1), end(table1), 0u);
std::shuffle(begin(table1), end(table1), generator);

std::iota(begin(table2), end(table2), 0u);
std::shuffle(begin(table2), end(table2), generator);
std::fill(begin(table1), end(table1), distrib(generator));
std::fill(begin(table2), end(table2), distrib(generator));
}

inline std::uint16_t operator()(const std::uint32_t originalValue) const
Expand Down
Loading