need some guidance
how can i produce a uniform distributed mapping function, from integers(let's assume less than 2^31) to integers between 0..n?
help would be appreciated!
There is no general way to uniformly map all integers from 0 to m to the set 0...n unless (n+1) is a divisor of (m+1). In this case, just take the number mod (n+1).
However, you can do the following: Determine the largest k such that k*(n+1)<=m. If the random number is <k*(n+1), use this number mod (n+1), otherwise get a new random number.
This is not the most efficient way to use your source of randomness, but for small n the difference is negligible.