hashing a small number to a random looking 64 bit integer

前端 未结 4 667
臣服心动
臣服心动 2021-01-12 16:54

I am looking for a hash-function which operates on a small integer (say in the range 0...1000) and outputs a 64 bit int.

The result-set should look like a random dis

4条回答
  •  伪装坚强ぢ
    2021-01-12 17:27

    1,000 * 1,000 = 1,000,000. That fits well within an Int32.

    Subtract the low bound of your range, from the number. Square it, and use it as a direct subscript into some sort of bitmap.

提交回复
热议问题