Randomizing repeated trails without having each condition presented an equal amount

Hello,
I’m creating a forced choice experiment with only 2 conditions. I need the trial to repeat 10 times and completely randomize which of the conditions is presented each time. However, the only option that I can see in the builder window is to have each condition represented an equal number of times (i.e. nReps asks for a value for the ‘number of repeats (for each condition)’). Is there a way to just have them completely randomised so that sometimes they aren’t equally presented?
Thank you :slight_smile:

1 Like

Set the nReps to some large value (say 100), and set the loop type to “full random”. This would mean that each trial of the possible 200 has an equal probability of being of each condition, and only over the entire 200 is there a guarantee of being balanced. You would then terminate the loop after 10 trials, which means that only on average would there be five trials of each in those first ten: the actual proportion will vary across subjects according to the binomial distribution.

To terminate the loop early, insert a code component (from the “custom” components panel), and in its “end routine” tab, put something like this to terminate the loop early (remembering that Python counts from zero):

if your_loop_name.thisN == 9: # after the 10th trial
    your_loop_name.finished = True

Amazing! Thanks again Michael, this worked a treat :smiley:
Pete