x, y = randint(m, n), randint(m, n)
while (x, y) in seen:
    x, y = randint(m, n), randint(m, n)
How to generate random pairs of numbers in Python, including pairs with one entry being the same and excluding pairs with both entries being the same?