This repository has been archived on 2025-07-07. You can view files and clone it, but cannot push or open issues or pull requests.
Files
eternos/frontend/style/node_modules/d3-array/src/shuffle.js
2025-01-11 09:54:09 +03:00

14 lines
329 B
JavaScript

export default shuffler(Math.random);
export function shuffler(random) {
return function shuffle(array, i0 = 0, i1 = array.length) {
let m = i1 - (i0 = +i0);
while (m) {
const i = random() * m-- | 0, t = array[m + i0];
array[m + i0] = array[i + i0];
array[i + i0] = t;
}
return array;
};
}