I'm trying to create an array of 8 integers, all random and unique e.g. {2,1,3,4,8,5,6,7} and using this I want to create a crossover function for the 8-Queen Problem. Once I have an index and backtrack to check the previous values, the random function fails...
==>Heres a bit of code to have an abstract idea........
import random
arr=[0 for i in range(8)]
arr[0]=random.randint(1,8)
for x in range(1,8):
for y in range(x,-1,-1):
if(arr[x]==arr[y]):
arr[x]=random.randint(1,8)
for q in arr:
print(q)