Hacker News new | ask | show | jobs
by codexon 5756 days ago
I thought he was being sarcastic when he said it looked random. Isn't that why he is asking for input?
1 comments

If he wants my input he should:

* Learn more about the theory behind hashes before designing one.

* Use a hash that distributes evenly across buckets.

* Learn what random looks like.

If it was random, all the numbers would be chosen with close to the same probability. So there would be an even number of items in each bucket. What we have here shows that bucket 1 is rarely chosen and bucket 7 is really common. The spread is so ridiculous (17.6k vs. 3.8k) that it cannot be due to chance.

In short, this is an absurd hash function. Do not use it in cryptography or elsewhere. If you need simple, low-cost, non-cryptographic hashes, look here:

http://www.cs.hmc.edu/~geoff/classes/hmc.cs070.200101/homewo...