source:
node_modules/es-toolkit/dist/array/sample.mjs
| Last change on this file was a762898, checked in by , 5 months ago | |
|---|---|
|
|
| File size: 138 bytes | |
| Line | |
|---|---|
| 1 | function sample(arr) { |
| 2 | const randomIndex = Math.floor(Math.random() * arr.length); |
| 3 | return arr[randomIndex]; |
| 4 | } |
| 5 | |
| 6 | export { sample }; |
Note:
See TracBrowser
for help on using the repository browser.
