I\'m using Python and was using numpy for this. I want to generate pairs of random numbers. I want to exclude repetitive outcomes of pairs with both entries being the s
@James Miles answer is great, but just to avoid endless loops when accidentally asking for too many arguments I suggest the following (it also removes some repetitions):
def gencoordinates(m, n):
seen = set()
x, y = randint(m, n), randint(m, n)
while len(seen) < (n + 1 - m)**2:
while (x, y) in seen:
x, y = randint(m, n), randint(m, n)
seen.add((x, y))
yield (x, y)
return
Note that wrong range of values will still propagate down.