UNPKG

@modern-kit/utils

Version:
16 lines (12 loc) 335 B
'use strict'; var arraySwap = require('../swap/index.cjs'); function shuffle(arr) { const result = arr.slice(); for (let i = result.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); arraySwap.swap(result, i, j); } return result; } exports.shuffle = shuffle; //# sourceMappingURL=index.cjs.map