Fix clustering over a discrete domain by using a hash function