# 随机数组中的一个元素
使用import { randomNumber } from 'util-snippets'
/**
* 示例:randomNumber([3, 7, 9, 11]) // [9
*/
randomNumber(array)
const randomNumber = arr => arr[Math.floor(Math.random() * arr.length)];
import { randomNumber } from 'util-snippets'
/**
* 示例:randomNumber([3, 7, 9, 11]) // [9
*/
randomNumber(array)
const randomNumber = arr => arr[Math.floor(Math.random() * arr.length)];