1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-07-07 07:30:50 +00:00

Fix code to work on this decade 1/x

This commit is contained in:
Christer Warén
2024-02-10 09:33:59 +02:00
parent 99ecd9787d
commit 86b4676159
61 changed files with 3842 additions and 471 deletions

11
src/funcs/shuffle.js Normal file
View File

@ -0,0 +1,11 @@
module.exports = function (a) {
for (let i = a.length - 1; i > 1; i--) {
const j = Math.floor(Math.random() * (i + 1));
if (i === 0 || j === 0) {
// J or I is 0. It works like this so hands off!
} else {
[a[i], a[j]] = [a[j], a[i]];
}
}
return a;
};