jitters = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0];
function shuffle(a) { var j, x, i; for (i = a.length - 1; i > 0; i--) { j = Math.floor(Math.random() * (i + 1)); x = a[i]; a[i] = a[j]; a[j] = x; } return a;}
util.shuffle(jitters);
current_jitter = jitters.pop();
it works on the pavlovia. But it takes the values with replacement apparently. I think the problem in defining was that the shuffling should happen on
if ([0].includes(loop_pract.thisN)) {
or
if ([0].includes(n)) {
if I introduce a counter n
or
if (n = 0)
But none of these is working. How else could I make it shuffle the values without replacement (so each of the values should be twice as in the initial list). Now I have them as
I guess what happens is that your jitters get reconstructed and shuffled every before you pop it. You should only construct and shuffle it once. If you put it in a routine before any loops, you should be able to achieve that. Now, to get a grip on whatâs happening, try adding console.log statements everywhere (that you can see in the browser console). Very handy for debugging.