UNPKG

foxts

Version:

Opinionated collection of common TypeScript utils by @SukkaW

2 lines (1 loc) 171 B
function r(e,t={}){let n,{copy:f=!1,random:l=Math.random}=t,o=f?e.slice():e,a=0,h=o.length;for(;h;)a=l()*h--|0,n=o[h],o[h]=o[a],o[a]=n;return o}export{r as shuffleArray};