@jswork/next-shuffle
v1.0.0
Published
Shuffle an array.
Downloads
4
Readme
next-shuffle
Shuffle an array.
installation
npm install -S @jswork/next-shuffle
usage
import '@jswork/next-shuffle';
const arr = [1, 2, 3, 4, 5];
nx.shuffle(arr); // [ 1, 4, 3, 5, 2 ]
another solution
function shuffleUseSort(aArr){
return aArr.sort(function(a, b){
return (0.5 - Math.random());
});
}
license
Code released under the MIT license.