Hacker News new | past | comments | ask | show | jobs | submit login

It's unclear to me what this is doing exactly -- is it finding the best ever? If not, why would the best change every time you run this?

Also, does anyone have pointers to a hash function discovery mechanism that discovers a good hash function for integer values within a specific range (i.e I know that my integer values are between, say, 10,000 and 200,000, for example) and I want to hash them into some optimal number of hash buckets?




It's randomly trying values to find the best of the ones it has tried that run. The values would change between runs because you can't feasibly exhaust the search space in a single run to find the absolute best (+the order you try is random).

If you're just looking for "good" the best approach is almost always to just use a normal hash function. If your numbers are extremely large and the range extremely small you can offset so the minimum becomes 0 again and use a smaller/faster hash. If you're more looking for "perfect choice of the exact range" I think the closest you'll get is something like this randomized approach but modify the tests to occur on your interval.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: