I have a study in which I am going to present 50 words in the learning trials, and 100 in the test trials. For the words in test trials, I want to present 30 randomly selected words from those 50 presented in the learning trials, and 70 additional distraction words. I also want to present all of them in random order. Is there a feasible way to do this in pavlovia?
hey @wakecarter,
using your cribsheet I came up with the solution below (for a minimal demonstration). It works offline, but on pavlovia I get this error: TypeError cannot read property ā0ā of undefined. Tried your suggested solution but it does not work.
targetwords = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
distractionwords = [10, 11, 12, 13, 14];
shuffle = util.shuffle;
shuffle(targetwords);
presentationrows = (targetwords.slice(0, 2) + distractionwords);
and then I put $presentationrows into selected rows part.
It would be really nice if you can help out, thanks!
I have figured out the problem, looks like I have to use .concat() method in JS.
targetwords = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
distractionwords = [10, 11, 12, 13, 14];
shuffle = util.shuffle;
shuffle(targetwords);
targetselected=targetwords.slice(0,2)
presentationrows =targetselected.concat(distractionwords);
This one works, thanks anyway!
Now you come to mention it, adding arrays is in my crib sheet (as in not being allowed to use +). I was distracted by slice which Iām sometimes unsure of