Hi everyone,

I’m trying to run my first Psychopy/Pavlovia experiment, but I am stuck with a semi-randomized assigment of each participant.

**What I have:** My experiment contains a total of 4 independent groups (planned are exactly 40 participants per group). Each condition contains videos that vary in frequencies (T vs. A) and one of two phase shift (i.e., in vs. out), leading to the conditions T_in, T_out, A_in, and A_out.

However, this is not enough… each condition will be presented in one of two sequence: Sequence 1 and Sequence 2, leading to a total of 8 groups already (T_in_seq1, T_out_seq1, T_in_seq2, T_out_seq2, A_in_seq1, A_out_seq1, A_in_seq2, A_out_seq2).

Again, not enough… My supervisor does not want a random assignment of our participant to one of those group. Instead, we need the same number of males and females within each of the 8 conditions and it is important that they are evenly distributed to each group to avoid something like one group is full but one didn’t even start, for example.

**What did I try so far?** I started by adding another “Experiment Info”, asking for the sex of each participant. I then thought I could assign Males and Females to one of two Excel-Sheets that contain the conditions. However, I really have no idea what I could do next to assign males/females to half of each condition (and sequence within the condition) and especially, how to make sure that it stops with one condition as soon as it has its max. number of participants.

Another idea was to give each male participant an ascending number from 1-80 (and females from 81-160) and previously pseudorandomize numbers 1-80 to each of the described conditions (same goes for females), but how does the program know which number is the next in line?

I am really desperate with this, since I am new to psychopy but especially to programming in general and I have no idea if this description makes kind of sense at all…

For a better visualization of all conditions, please see the list below. I really hope it helps!

Thank you so much in advance!! I appreciate every help!!!