in reply to Re: Short hash algorithm
in thread Short hash algorithm
Taking the modulus doesn't prevent people from guessing the next and/or previous key, as it will likely still be n+1 or n-1, if the modulus is large enough. But based on the modulus idea, one could use the linear method used by random number generators - take a large prime number, multiply the record number by it, and then take the modulus - this should give a fairly good distribution, but I'd still look at what Knuth (or some other book) says about the algorithm. I think it's called Linear Random Number Generator, but it might be called something else.
|
|---|