Randomly selecting a condition file for each participant does not work on Pavlovia

Hi,

In my experiment, I would like to randomly select a condition file for each participant, because each file contains different set of stimuli.

So in the code component (Begin Experiment), I put

condNum = randint(1,1000)
condFile = 'condFiles/condFile' + str(condNum) + '.csv'

and I put $condFile under the condition property of the loop.

It works on my local computer, but it does not work on Pavlovia.
Is it possible to do so on Pavlovia?

Any help would be much appreciated!

Hi,

Try something like this:

condNum = Math.floor(Math.random() * (1000 - 1 + 1)) + 1;
condFile = 'condFiles/condFile' + n.toString(condNum) + '.csv'
1 Like

@Omidrezaa thank you very much!
It turns out that the code was correct, I just need to manually put every relevant file into the html folder.