hash function providing unique uint from an integer coordinate pair

前端 未结 11 1968
隐瞒了意图╮
隐瞒了意图╮ 2020-12-13 10:09

The problem in general: I have a big 2d point space, sparsely populated with dots. Think of it as a big white canvas sprinkled with black dots. I have to it

11条回答
  •  孤街浪徒
    2020-12-13 10:27

    the Fibonacci hash works very well for integer pairs

    multiplier 0x9E3779B9

    other word sizes 1/phi = (sqrt(5)-1)/2 * 2^w round to odd

    a1 + a2*multiplier

    this will give very different values for close together pairs

    I do not know about the result with all pairs

提交回复
热议问题