MCPcopy Create free account
hub / github.com/creationix/node-sdl / shuffle

Function shuffle

examples/Chaser.js:22–29  ·  view source on GitHub ↗
(array)

Source from the content-addressed store, hash-verified

20}
21
22function shuffle(array) {
23 for (var i = 0, l = array.length; i < l; i++) {
24 var j = Math.floor(Math.random() * l);
25 var temp = array[i];
26 array[i] = array[j];
27 array[j] = temp;
28 }
29}
30
31var colorNames = Object.keys(colors);
32shuffle(colorNames);

Callers 1

Chaser.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected