MCPcopy Create free account
hub / github.com/adobe/leonardo / shuffleArray

Function shuffleArray

docs/ui/src/js/utils.js:442–457  ·  view source on GitHub ↗
(array)

Source from the content-addressed store, hash-verified

440}
441
442function shuffleArray(array) {
443 let currentIndex = array.length,
444 randomIndex;
445
446 // While there remain elements to shuffle...
447 while (currentIndex != 0) {
448 // Pick a remaining element...
449 randomIndex = Math.floor(Math.random() * currentIndex);
450 currentIndex--;
451
452 // And swap it with the current element.
453 [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];
454 }
455
456 return array;
457}
458
459function createColorData(color, mode) {
460 const f = getChannelsAndFunction(mode);

Callers 1

getCvdSafeColorsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected