function RandomizeNoMoreThan(predicate,n) {
this.args = [predicate];
this.run = function(arrays) {
let moreThanN = true;
let order;
while (moreThanN){
order = randomize(predicate).run(arrays);
moreThanN = false;
let previousType = "";
let current_n = 0;
for (let i = 0; i < order.length; i++){
let currentType = order[i][0].type;
if (currentType != previousType)
previousType = currentType;
else{
current_n++;
if (current_n > n){
moreThanN = true;
break;
}
}
}
}
return order;
};
}
function randomizeNoMoreThan(predicate, n) {
return new RandomizeNoMoreThan(predicate,n);
}
function RandomizeNoMoreThan(predicate,n) {
this.args = [predicate];
this.run = function(arrays) {
let moreThanN = true;
let order;
while (moreThanN){
order = randomize(predicate).run(arrays);
moreThanN = false;
let previousType = "";
let current_n = 0;
for (let i = 0; i < order.length; i++){
let currentType = order[i][0].type;
if (currentType != previousType){
current_n = 1;
let currentType = order[i][0].type;
with let currentType = order[i][0].type.replace(/_.+$/,'');
--
You received this message because you are subscribed to a topic in the Google Groups "ibexexperiments" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ibexexperiments/1987FoZKo6k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ibexexperimen...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ibexexperiments/c84655e7-31d6-4ea1-874b-68a0b46ee689%40googlegroups.com.
var shuffleSequence = seq("intro", "instructions", "instructions2", "instructions3",
sepWith("sep","practice"), "endPrac", "setcounter",
sepWith("sep", randomizeNoMoreThan(anyOf("cond1", "cond2", "cond3","filler1","filler2"),3)),
"send_results", "end");
let currentType = order[i][0].type;
with let currentType = order[i][0].type.replace(/\d+$/,'');