Download node_modules/d3-array/src/shuffle.js from NKessler/Horizon: direct link, hf CLI and curl.
- Browser
- Download file 329 Bytes
-
https://huggingface.co/NKessler/Horizon/resolve/main/node_modules/d3-array/src/shuffle.js
- Command line
-
hf download hf://NKessler/Horizon/node_modules/d3-array/src/shuffle.js
-
curl -L -o shuffle.js https://huggingface.co/NKessler/Horizon/resolve/main/node_modules/d3-array/src/shuffle.js
329 Bytes
| export default shuffler(Math.random); | |
| export function shuffler(random) { | |
| return function shuffle(array, i0 = 0, i1 = array.length) { | |
| let m = i1 - (i0 = +i0); | |
| while (m) { | |
| const i = random() * m-- | 0, t = array[m + i0]; | |
| array[m + i0] = array[i + i0]; | |
| array[i + i0] = t; | |
| } | |
| return array; | |
| }; | |
| } | |