| Reference | Downloads | Github

Randomise stimuli without consecutive presentation


I am programming a psychological experiment.
In every trial, they read a scenario and see a face photo and hear an answer for the scenario.

Scenarios are 20.
And there are 4 conditions for the scenarios. (Happy face-Happy sound, Neutral face-Happy sound, Happy face-Neutral sound, Neutral face-Neutral sound)

Therefore, All trials are 80. (Scenario 20 * Condition 4)

The point is I need to randomize scenario order without repeating stimuli twice in a row.
My problem is that the “random trials” must NOT include consecutive presentations of one scenario.
For example, scenario 1(Happy f-Happy v) → scenario 1(Happy f-Neural v)
Or scenario 1 - 3 - 5 - 6 - 7- 8 - 3 - 4 - 4- 5 - 10

However, I am very new to psychopy/coding and am not sure of how to do this.
Is anyone able to please help guide me in generating a code that will constrain the randomisation process so that no one square/keys be presented consecutively?


Hello you330,

you need some code to do this.

These should give you the relevant information.

Best wishes Jens