So I was supposed to use hash some co-ordinates and I was supposed to use k 3-wise independent hash functions in order for the mathematical explanations behind that algorithm to be hold. But after using k 3 wise independent hash functions, I got kinda bad accuracy(I used tabulation hashing which I myself wrote for this. Then I decided to use some cryptographic hash function for collision resistance and ended up using sha256 in this way
- As I have to generate k different hash functions for my purpose, I generated k different seeds and wrote this snippet -
hex_num = hashlib.sha256((str(self.seed[i])+str(d)).encode('utf-8')).hexdigest() int_hex = int(hex_num[:5],16) index = int_hex % self.width
where I want to get the hashed values in the range of 0 to self.width-1. Now I had a few questions-
- The probability of two different items hashed to the same slot by the same hash function.
- After going this SHA256 output to 0-99 number range? , Can we assume that a hash function with high collision resistance also means a highly uniform distribution? I was still wondering what can be the probability mentioned above. Any help will be appreciated! Cheers !