Randomly select conditions

Hello! It’s my first time using Psychopy and I have little experience with python, that’s why I’m using the builder.
In my experiment, two subtasks designed in two routines are presented in a block. Within that block, the first task presents 48 conditions that are presented 48 times and the second task has 96 conditions of which only 16 are chosen at random. Conditions from subtasks 1 and 2 are randomly presented in that block. I’ve made the randomization between the two subtasks happen with the suggestion (Switching between different routines (subtasks) after one trial each - #6 by Becca). But I can’t select only 16 conditions of the second subtask at random.
I tried terminating the loop with an if, but it doesn’t work. Is there any suggestion?

Your code seems to be ending the trials loop when it is already ending. Do you:

a) Want to end the Block loop once trials has run 16 times or

b) Only run the TrialsSelection loop once the trials loop has run 16 times


Hi @wakecarter

Thank you for your generous help. The conditions between trials and TrialSelection should be randomly mixed. I want the trials loop to finish when it has run 16 times while the TrialSelection loop continues until it completes 48 times.