I want to hash a char array in to an int or a long. The resulting value has to adhere to a given precision value. The function I\'ve been using is given below:
Hashes generate the same value for different inputs -- that's what they do. All you can do is create a hash function with sufficient distribution or bit depth (or both) to minimize those collisions. Since you have this additional constraint of precision (0-5 ?) then you are going to hit collisions far more often.