I did go through Korth's book of DBMS and I got these definitions:


Each bucket is assigned the same number of search-key values from the set of all possible values.


Each bucket will have the same number of records assigned to it irrespective of the actual distribution of search-key values in the file.

These definitions seem similar to me. Can anyone please differentiate, I did search on net but can't understand.


1 Answer 1


Uniformity is about potential values, while randomness is about actual values.

For example, suppose you make a very simple hash function that takes the first byte of a string, resulting in 256 buckets. It is uniform, because the number of possible strings starting with a particular byte doesn't depend on. But it is not random for most data sets: at least 12.5% of the values consist of nonprintable characters (control characters) that most data sets don't contain, some characters like )]} rarely appear at the beginning of a string, an English dictionary contains more words beginning with a than with z, etc.

Randomness is defined with respect to a specific data set. For example, if the data set consists of SHA-1 hashes of typical strings, then taking the first byte satisfies the randomness property. If the data set consists of people's surnames, it doesn't. If the data set consists of SHA-1 hashes strings that are deliberately chosen so that their SHA-1 hash starts with the byte 0, then taking the first byte doesn't satisfy randomness either.

In fact, there is no hash function that satisfies randomness for all datasets: for any hash function (with at least two buckets), a data set consisting solely of values that hash to bucket 0 violates randomness. The best you can hope is hash functions that satisfy randomness for datasets that are not deliberately crafted to violate randomness. This is possible in practice if the hash function includes a random factor which is based on a secret seed.

  • $\begingroup$ You could use a hash function that uses actual randomness and a lookup table for reproducibility to satisfy the definition with high probability for any input set (if you assume "equal number" means "approximately equal"). $\endgroup$
    – adrianN
    Jun 9, 2016 at 14:56
  • $\begingroup$ @adrianN Good point, I was assuming a function in the mathematical sense, i.e. something that doesn't depend on the sequence of inputs, as opposed to code that has access to mutable state. $\endgroup$ Jun 9, 2016 at 16:00
  • $\begingroup$ A function that uses randomness can be thought of a random function from the family of hashfunctions. If the attacker doesn't know which hash function is used he can't prepare adversarial input. Under this assumption the definition in the question makes more sense I think. $\endgroup$
    – adrianN
    Jun 10, 2016 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.