I ran into the problem of having multiple integers, and I have to generate them using them. For example.
Int 1: 14
Int 2: 4
Int 3: 8
Int 4: 4
Hash Sum: 43
I have some restriction in the values, the maximum value that an attribute can have is 30, adding all of them is always 30. And the attributes are always positive.
The key is that I want to generate the same hash amount for similar integers, for example, if I have integers, 14, 4, 10, 2, then I want to generate the same hash amount in the case above 43. But, of course, if the integers are very different (4, 4, 2, 20), then I should have a different hash amount. It should also be fast.
Ideally, I would like the hash sum output to be between 0 and 512, and it should be evenly distributed. With my limitations, I can have about 5K of different capabilities, so what I would like to have is about 10 for each bucket.
I am sure there are many algorithms that do this, but I could not find a way to find this thing. Can someone send an algorithm for this?
Additional Information
The thing is that these integers are attributes for the function. I want to store function values in a table, but I do not have enough memory to store all the different parameters. This is why I want to generalize between similar attributes.
The reason 10, 5, 15 is completely different from 5, 10, 15, because if you represent it in 3d, then both points are a completely different point
Additional Information 2
, . , . , . 3 , 3d, .
if (att[0] < 5 && att[1] < 5 && att[2] < 5 && att[3] < 5)
Block = 21
if ( (5 < att[0] < 10) && (5 < att[1] < 10) && (5 < att[2] < 10) && (5 < att[3] < 10))
Block = 45
, ifs, .