# 随机数组中的一个元素

使用
import { randomNumber } from 'util-snippets'

/**
 * 示例:randomNumber([3, 7, 9, 11]) // [9
 */

randomNumber(array)
代码
const randomNumber = arr => arr[Math.floor(Math.random() * arr.length)];