| Reference | Downloads | Github

Random stimulus presentation repeats


What are you trying to achieve?:
I am running a two-alternative forced choice task where participants make judgements about a set of images. It begins with practice task of 8 stimuli, where participants need to answer 100% correctly twice around (i.e., 16 total trials), to continue to the main task. If they respond incorrectly to one or more of the 16 trials, all practice trials are repeated until all are answered correctly.

What did you try to make it work?:
I created an outer loop (with the routine loop nested within it) that repeats the practice trials if less than 100% of them were answered correctly within the first round, as per these instructions: Repeat trial if answers are incorrect

What specifically went wrong when you tried that?:
This worked well. I would now like to make it so that there are no consecutive stimulus repeats. I believe the consecutive repetition is only possible if the last stimulus in the first round of 8 happens to be the same as the first stimulus in the second round of 8. Or if the stimulus on the first 16 practice trials (that the participant did not get completely correct) matched the first stimulus on the second sixteen trials.

I hope this makes sense! And I really appreciate the assistance offered by this forum.



Although it seems like a simple request, this isn’t possible without some involved custom code.

Would it be sufficient to insert a pause between the last trial and the first trial of the next set, so that any possible repetition isn’t presented immediately? This could be done by inserting a pause routine between the inner and outer loops (i.e. not nested inside the innermost loop, just the outer one).



Hi Micheal,

By involved custom code do you mean code in the coder section rather than inserted into the routine?

If need be we could alter the experiment in some way to avoid this (e.g., breaks between outer loop repeats).

Is it possible in a sequence of random stimulus presentation to ensure two or more adjacent stimuli in a list don’t directly follow one another? That way instead of having two 2 reps of the inner routine loop I could have one rep with each stimulus listed twice and ensure they don’t repeat that way. We would still have the problem of last stimuli on inner loop and first stimuli on outer loop being identical but we could separate this with a break.



We go in to detail of all the randomisation options in the text book from page 151:

But in essence, if you don’t want consecutive items appearing, you can’t have repeated values in your list of conditions. You can use the “random” option with multiple reps, but there can be consecutive values at the start and end of each rep. The easiest option is to have nReps of 1 and an outer loop to reap the inner one with the pause routine to separate any possible consecutive presentations.

Yes, you can do anything arbitrarily flexible if you write code instead of/to supplement using Builder’s graphical approach. But it is a non-deterministic algorithm: you effectively need to just continue generating random orderings until you find one that meets your constraint of having no consecutive items.