better hash function for subsampling