deno.land / x / rambda@v9.1.1 / source / shuffle.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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}
rambda

Version Info

Tagged at
2 months ago