Hello,

I am trying to "shuffle" an array of numbers in FramerJS. To my understanding the fastest way to do this is with the Fisher-Yates Shuffle (see http://bost.ocks.org/mike/shuffle/ or http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).

I am wondering how to run this in FramerJS, considering I cannot seem to use a while loop?

This algorithm involves the following JavaScript code.

function shuffle(array) {

var m = array.length, t, i;

while (m) {

i = Math.floor(Math.random() * m--);

t = array[m];

array[m] = array[i];

array[i] = t;

}

return array;

}

## 6 Comments