Very low cost hash function

后端 未结 5 1985
死守一世寂寞
死守一世寂寞 2020-12-25 08:33

I need a hash function for a Look Up table, so that if my values are from 0 to N, I need a hash function that give me a value from 0 to n, being n << N. Another piece

5条回答
  •  -上瘾入骨i
    2020-12-25 09:34

    Rewire bits in random order and take lower log2(n) bits

    Or just take lower log2(n) bits if your data is evenly distributed.

提交回复
热议问题