I've list of indexes of images and it's length is 60000. I want to create another list which contains random pairs of indexes. The constraint here is each element of product set should contain distinct indexes. In other words I don't want to pair an index with it self.
Currently I've been using itertools.product method with for loop.
pairs = []
for pair in itertools.product(indexes, indexes):
if pair[0]!=pair[1]:
pairs.append(pair)
To problem it is taking a lot time and I couldn't use my computer because it gets stuck.
Is there better way of doing this?