Hi @thewall79, found this on stack overflow (see link below):
import random
while 1:
choices = [1, 2, 3] * 1000
shuffle = []
last = ""
while choices:
l = choices
if last:
l = [x for x in l if x != last]
if not l:
#no valid solution
break
newEl = random.choice(l)
last = newEl
shuffle.append(newEl)
choices.remove(newEl)
if not choices:
print(shuffle)
break
Adapted from https://stackoverflow.com/a/35784338