Hello,
I want to choose a random element from multidimensional array. I have this code but I have "list indices must be integers or slices not tuple" error
I have this array: [[000],[001],[010]…] and I want to choose 1 triplet inside this array randomly like [001]
Here is my code
I want to choose a random element from multidimensional array. I have this code but I have "list indices must be integers or slices not tuple" error
I have this array: [[000],[001],[010]…] and I want to choose 1 triplet inside this array randomly like [001]
Here is my code
random_angles = [] for triplet in itertools.product([th2, th1], repeat=3): random_angles.append(triplet) #print(random_angles) choosen_triplet_m= [] for i in range (10): choosen_triplet = np.random.randint(3, size=1) print("choosen triplet",random_angles[choosen_triplet[0],:]) choosen_triplet_m.append(random_angles[choosen_triplet[0],:])How can I solve this error??