I am creating an conditioning experiment with three conditions (0,1,2) and need to pseudo-randomize condition order. I need a randomize list with each condition occurring only 2 times in a row. Here how I tried to achieve it. The code is running but it takes an eternity...
Any ideas why this code is not working well and any different approaches to solve the problem?
#create a list with 36 values
types = [0] * 4 + [1] * 18 + [2]*14 #0=CS+ ohne Verstärkung; 1 = CS-, 2=CS+ mit shock
#random.shuffle(types)
while '1,1,1' or '2,2,2' or '0,0,0' in types:
random.shuffle(types)
else: print(types)
Thank you in advance! Martina