Blocks not randomized in pavlovia

In general - yes. But the specifics depend on on how you want to control the ordering of the blocks. If you want it to be chosen randomly, once for the whole experiment, then you could add a code component to the first routine you have (the code component can be fund under Custom components). Then in the code component you’d have to choose “js” in the CodeType (as far as I know automatic python->js translation does not handle generating random values well, but I may be wrong). In the textbox under “Begin Experiment” you can then write:

randval = Math.random()

if (randval < 0.5) {
  n_rep_b1a = 1;
  n_rep_b1b = 0;
} else {
  n_rep_b1a = 0;
  n_rep_b1b = 1;
}

(this code was not tested and I don’t program in javascript so it may not work or at least be suboptimal!)
Then in your loops that control whether given block is presented you would put in the nReps field:

  • for B1a block loop: n_rep_b1a
  • for B1b block loop: n_rep_b1b
1 Like