Cknuth Hash

std::uint32_t knuth(int x, int p) {
    const std::uint32_t knuth = 2654435769;
    return (x * knuth) >> (32 - p);
}
Disturbed Deer