Hacker News new | ask | show | jobs
by jagged-chisel 1112 days ago
I can’t find the text you quoted. The article starts off:

> A hash function is any function that can be used to map data of arbitrary size to fixed-size values

And the first sentence in the section you link says

> A good hash function should map the expected inputs as evenly as possible over its output range.

It doesn’t have to be “good” to be a hash function.

1 comments

That's not a meaningful definition of a hash function, then.

    def hash(val):
        return 0
Yes, this is a hash function. Whether it’s “useful” or “good” is the purview of the architect.

Tangential edit: https://xkcd.com/221/

The best thing about that one is that it seeds the panel with a random number every time you refresh
That has a pretty uniform distribution..