The outpus:
list after shuffle:
[17, 9, 2, 18, 19, 8, 25, 12, 15, 22, 21, 26, 23, 4, 24, 5, 14, 10, 27, 20, 3, 13, 16, 7, 6, 1, 11]
corresponding relationship:
{17: (0, 0, 0), 9: (1, 0, 0), 2: (2, 0, 0), 18: (0, 1, 0), 19: (1, 1, 0), 8: (2, 1, 0), 25: (0, 2, 0), 12: (1, 2, 0), 15: (2, 2, 0), 22: (0, 0, 1), 21: (1, 0, 1), 26: (2, 0, 1), 23: (0, 1, 1), 4: (1, 1, 1), 24: (2, 1, 1), 5: (0, 2, 1), 14: (1, 2, 1), 10: (2, 2, 1), 27: (0, 0, 2), 20: (1, 0, 2), 3: (2, 0, 2), 13: (0, 1, 2), 16: (1, 1, 2), 7: (2, 1, 2), 6: (0, 2, 2), 1: (1, 2, 2), 11: (2, 2, 2)}
The corresponding codes:
import numpy as np
a = []
for _ in range(1,28):
a.append(_)
np.random.shuffle(a)
print("list after shuffle: ")
print(a)
coordinates = []
for i in range(0,27):
if (i % 3 == 0):
x = 0
elif (i % 3 == 1):
x = 1
else:
x = 2
if (0 <= (i % 9) <= 2):
y = 0
elif (3 <= (i % 9) <= 5):
y = 1
else:
y = 2
if (0 <= i <= 8):
z = 0
elif(9 <= i <= 17):
z = 1
else:
z = 2
temp_tuple = (x, y , z)
coordinates.append(temp_tuple)
d = dict(zip(a, coordinates))
print("corresponding relationship:")
print(d)