psychopy.org | Reference | Downloads | Github

Randomize Order of Trials in Code

URL of experiment: https://run.pavlovia.org/djangraw/mmicondition-covid19/html
code: https://gitlab.pavlovia.org/djangraw/mmicondition-covid19

Description of the problem: I want the same experiment to work under three different conditions. In one (condition=open), the trial order should be sequential, but in another (condition=random), it should be random.

I tried to accomplish this by setting the trialLoop’s loopType parameter to sequential and writing code to randomize the trial order in a variable passed to the loop’s “selected rows” parameter. But somewhere inside the loop, it re-sorts this list, and I always get the values in ascending order. Is there a way to specify a specific trial order, or to set the loopType to either sequential or random in javascript (while still retaining ties to the builder)?