Skip to main content
Module

x/rambda/source/shuffle.js

Faster and smaller alternative to Ramda
Go to Latest
File
export function shuffle(arrayRaw) { const array = arrayRaw.concat() let counter = array.length while (counter > 0) { const index = Math.floor(Math.random() * counter) counter-- const temp = array[counter] array[counter] = array[index] array[index] = temp }
return array}