Reply To: Randomizer

PennController for IBEX Forums Support Randomizer Reply To: Randomizer


Hi Marc,

I think mixing in other trials inside the “GreetingsTrial” is incompatible with the modifyRunningOrder function we discussed in our email exchange. So you would be better off using a custom shuffle sequence function instead of using modifyRunningOrder:

function KeepOneInGroupAfter(x,sep='_') {
    this.args = [x]; = function(arrays) {
        const ret = []
        const sources = {};
        arrays[0].forEach( r=> {
            let type = r[0].type.split(sep);
            type = type.join(sep);
            sources[type] = [...(sources[type]||[]),r];
        for (let k in sources){
            fisherYates(sources[k])  // Randomize trials in the group
            ret.push(sources[k][0])  // Add first trial in the group
        return ret;
function keepOneInGroupAfter(x,sep) { return new KeepOneInGroupAfter(x,sep); }

Then you can do this:

Sequence("consent", "practice", rshuffle(keepOneInGroupAfter(startsWith("GreetingsTrial")), "other"), "send", "final")