Randomly picking 2 integers to compute a third one with equiprobability

24 Views Asked by At

I have a problem, that might be simple but I just don't see it for the moment.

Supposing you have a finite set of integers $S_1$, I am looking for a simple function that when randomly picking two integers $x$ and $y$ from $S_1$ and returns another integer $z$ in a second defined set $S_2$ (such as $[-16, 16], [-20, 20]\ldots$), knowing that if we repeat the function a large number of times, z has to appear in a equiprobable manner.

Thanks for your help!

1

There are 1 best solutions below

3
On BEST ANSWER

If the cardinality of $S_2$ does not divide that of $S_1 \times S_1$, it can't be done. If it is divisible, it's easy.