| Reference | Downloads | Github

Randomizing Blocks

OS (e.g. Win10): Mac sierra 10.12.1
PsychoPy version (e.g. 1.84.x): 3.0
Standard Standalone? (y/n) y
What are you trying to achieve?: trial randomization

I am trying to randomize the presentation of 3 blocks in a dot probe task. Each block contains 20 trials that have successfully been randomized. However, I am having trouble randomizing the presentation of blocks to participants so that, for example, block 1 can be seen first then block 2 and 3, and then for other participants they would see blocks 2,3,1 or any other order.

I have reviewed multiple posts on this issue and still am having issues. I am a PsychoPy novice but have attempted to use code to randomize the orders of the blocks with no success.

What did you try to make it work?

I tried to put a loop around the routines that I want to be randomised with the conditions file having the names of the individual excel files (block trials and counterbalancing).

I also tried to use a spreadsheet with three columns and three rows. I used headers as nReps and each row and column I used 1 and two 0s.

I also attempted to remove the fixation point and only have the 3 blocks but had no success.

What specifically went wrong when you tried that?

My blocks would not randomize.

Any guidance would be much appreciated!


If by blocks you mean appear, stig and gen I’m afraid you cannot randomize the order of routines. If the different stimuli routines do not differ to much I would try and combine them to one routine, which then can be set to correct values etc. by a loop running 3 times.

EDIT: I was wrong… Hehe

Thank you for your reply. I have attempted to combine all routines into one. However, I am having issues with the presentation of each routine.

The dot probe task that I am trying to create begins with word pairs, followed by a dot replacing one of the words, to which the participant must press a key to indicate the location of the dot, and then a fixation point. Each block contains different types of words that I would like to keep separate. I am not sure how to create one routine for each block…how would you approach this?


Graphical user interface, application Description automatically generated


Graphical user interface Description automatically generated


Graphical user interface Description automatically generated

Much appreciated!

1 Like

Did you add any pictures in your reply? I can only see empty white squares with some generated text underneath.

That is odd… attempt # 2



You can randomise the order of routines, using the method that the OP has outlined.

Loop randomising should point to a spreadsheet with three columns. In each row there should be a 1 and two 0s. The column names are then used as the nReps for appear, stig and gen.

@Thalia – please show your four loop definitions and the contents of your randomising spreadsheet.

1 Like

Here are the properties for the 3 inner loops;

Here are the properties for my outer loop and corresponding spreadsheet;


I have also tried;

Delete col A
Name cols B-D playAppear, playstig, playGen

Put these variables as the nReps in attract, stig and gen.


IT WORKED! I cannot thank you enough!

1 Like

My bad, I was not aware of this!
Glad it worked out :clap:

1 Like