You-Dont-Need-Lodash-Underscore
You-Dont-Need-Lodash-Underscore copied to clipboard
Add entry for _.shuffle
shuffle can be implemented like this:
function shuffle (array) {
const result = array.slice()
const len = result.length
let tmp
let rndPos = 0
for (let i = 0; i < len; ++i) {
tmp = result[rndPos = i + Math.floor(Math.random() * (len - i))]
result[rndPos] = result[i]
result[i] = tmp
}
return result
}
what we have to shuffle in this
?
What do you mean?
what we have to shuffle in your website
What's the equivalent in lodash?
@stevemao
Its shuffle: https://lodash.com/docs/4.17.15#shuffle
PR welcome