46
Create a map that takes the output of a random function without the range restriction and map it to the range you want with restrictions.
For example, if I want a random int from 1-10 but never 7 I could do something like this:
int i = rand(1, 9);
if i>=7
i++;
return i;
As long as you ensure that your mapping is 1:1, you can avoid skewing the randomness of your rand function.