There were similar question on stackoverflow but not exactly mine.
So i have a sequence of numbers (from 1 to ~5,000,000) (call this number N). I want to map every number to a number from [0, 99]. One solution is to take the reminder of N divided by 100. All good. I again want to do this a second time and see to which number from [0, 99] this N gets mapped to. The only requirement is that the information that the N got mapped to a number from [0, 99] (say 34) the first time should not decide anything about the number it gets mapped to the second time.
So I want to do this (SHA(N + 1) % 100) on the first time and (SHA(N + 2) % 100) the second time and so on ..
Is it guaranteed to work ? or am i missing out something?
Simply put: Take any two arbitrary numbers x1, x2 from [0, 99]. Count all numbers from [0, 5000000] which gets mapped to x1 the first time and x2 the second time. Is this count going to be the same (more or less) for any choice of x1,x2?