Reply To: Randomization with no more than three items of same category in a row

PennController for IBEX Forums Support Randomization with no more than three items of same category in a row Reply To: Randomization with no more than three items of same category in a row

#8241
Jeremy
Keymaster

Hi,

You need to include the category information in the trials’ labels, otherwise the various sequence functions will have no way of knowing which trial is from which category, and therefore you’ll have no hope of constraining their distribution

I wrote a function called randomizeNoMoreThan that does what you want. Once you’ve added a .js file defining the function to your project’s Modules folder, you can proceed to the following modifications:

  • replace newTrial("experimental_items" with newTrial("experimental_items_"+row.Kategorie
  • replace critical = randomize("experimental_items"); with critical = randomizeNoMoreThan(startsWith("experimental_items"), 3);
  • replace all three occurrences of rshuffle(pick(critical, 61)) with pick(critical, 61)

Since pick selects consecutive trials from a set (ie. the next 61 trials it picks follow the previous 61 trials it picked in the set stored in the critical variable) and since the set stored in critical has been randomized using randomizedNoMoreThan, you should get the desired behavior

Jeremy