# Speed up for loop

Hi all, I have a loop as following:
for i in range(1000000):
SK1 = random.choice(binc1)
SK2 = random.choice(binc2)
SL1 = random.choice(binc1)
SL2 = random.choice(binc2)
while SK1 == SL1:
SL1 = random.choice(binc1)
while SK2 == SL2:
SL2 = random.choice(binc2)
#print("PC1_S.index(SK1) = ",PC1_S.index(SK1))
#print("PC2_S.index(SK2) = ",PC2_S.index(SK2))
F[binc2.index(SK2)][binc1.index(SK1)] = gaussian(SK1,binc1,SK2,binc2)
F[binc2.index(SL2)][binc1.index(SL1)] = gaussian(SL1,binc1,SL2,binc2)
W_SK = Wn[binc2.index(SK2)][binc1.index(SK1)] * F[binc2.index(SK2)][binc1.index(SK1)]
W_SL = Wn[binc2.index(SL2)][binc1.index(SL1)] * F[binc2.index(SL2)][binc1.index(SL1)]
if W_SK < W_SL:
SK1 = SL1
SK2 = SL2
else:
a = random.random()
if W_SL/W_SK > a:
SK1 = SL1
SK2 = SL2
else:
SK1 = SK1
SK2 = SK2
#print(‘SK =’,SK)
count[binc2.index(SK2)][binc1.index(SK1)] = count[binc2.index(SK2)][binc1.index(SK1)] + 1

where binc1 and binc2 are two np.arrays, is there anyway I can use pytorch to speedup this for loop?