Randomly pick one number that is different than two other random numbers Two random numbers A and B have been generated to be either 1, 2, or 3
your job is to randomly pick a third number C that can also be 1, 2 or 3. But, C cannot equal A or B.

A can equal B.
If A = B, then C has only two numbers left it can be.
If A ≠ B, C has only one number it can be.
Assume A and B have already been chosen for you

This is how A and B would be created in Python
A = random.randrange(1,4)
B = random.randrange(1,4)

Assume this is already in your code.
This is the shortest I've come up with in Python
while True:
    C = random.randrange(1,4)
    if C != A and C != B:
        break

Here are some acceptable values for A, B and C.

1,2,3
1,1,2
2,3,1
3,3,2

Here are some unacceptable values for A, B and C.

1,2,1
2,3,3
1,1,1
3,2,3
Ruby, 22 characters

([1,2,3]-[A,B]).sample


Still not sure if I understood the question correctly ...