jspsych / jsPsych

Create behavioral experiments in a browser using JavaScript
http://www.jspsych.org
MIT License
1.03k stars 668 forks source link

randomization.repeat without duplicate neighbors #153

Closed jodeleeuw closed 9 years ago

jodeleeuw commented 9 years ago

From the jsPsych google group:

We have a list of 10 stimuli (images) repeating for 500 trials. We need to make sure that the same stimulus is not presented on consecutive trials. Is there any way to do this?

currently we are using:

var myArray = [1,2,3,4,5,6,7,8,9,10];
var shuffledArray = jsPsych.randomization.repeat(myArray, 50);
// output would present us with 500 random images, which is great, but some images will repeat
// output: shuffledArray = [1,6,4,2,2,5,7,7,3,10,....]

We would need the output such that no image would repeat, but would still be randomly assigned for 500 trials. // output: shuffledArray = [1,9,4,2,3,7,5,8,10, 6,....]

jodeleeuw commented 9 years ago

implemented on /dev