ran npm run tdd & generated TDD
This commit is contained in:
8
test/shuffle/shuffle.js
Normal file
8
test/shuffle/shuffle.js
Normal file
@ -0,0 +1,8 @@
|
||||
module.exports = ([...arr]) => {
|
||||
let m = arr.length;
|
||||
while (m) {
|
||||
const i = Math.floor(Math.random() * m--);
|
||||
[arr[m], arr[i]] = [arr[i], arr[m]];
|
||||
}
|
||||
return arr;
|
||||
};
|
||||
Reference in New Issue
Block a user