| 440 | } |
| 441 | |
| 442 | function 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 | |
| 459 | function createColorData(color, mode) { |
| 460 | const f = getChannelsAndFunction(mode); |