| Reference | Downloads | Github

Randomising each trial with builder

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Mac):
PsychoPy version (e.g. 3.0.1):

The situation is we have two sequential picture stimuli in each trial (pressing the button to change from the first to the second), which has been done with only the builder and a spreadsheet!
And we have 24 trials in total. We want to randomise the order of each trial, but we don’t know how. Could you please advise us with that? We have no previous coding experience, it will be helpful if it can be done in the builder only.

Yes - this is possible with the builder.

I believe your loopType should be set to “Random”.

Your total number of trials will be nReps multiplied by the number of conditions (rows) in your spreadsheet. So to get 24 trials you would need 12 nReps * 2 conditions in your spreadhseet.

Do you mean you want to randomise the sequential order of image 1 and image 2?
Do you have two stimuli components in builder?

Is it possible to share a screenshot of your spreadsheet so I can understand your conditions… I am also new to psychopy but might be able to help.


Thank you so much. But I need image 1 and image 2 to be in fixed sequence. and trial 1 to trial 24 to be presented in a random sequence.

Hi Jiuzhou,

Apologies, I am not sure of which variable you are changing in your 24 trials? How do these trials differ? It appeared from your first post that you were changing the filepath for Image1, Image2 and Image3 - and you had only 2 conditions in your spreadsheet.

For example, have you looked at the “loops” and “method of constants” section of this page:

You can see - normally a spread sheet is set up to define different conditions and specific the variables in each condition. A loop is set around your routine to create a random shuffle through your conditions