Two random numbers
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 = B, then
Chas only two numbers left it can be.
A ≠ B,
Chas only one number it can be.
Bhave already been chosen for you
This is how
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
Here are some unacceptable values for