【文件属性】:
文件名称:pick-random:从列表中选择随机项目
文件大小:5KB
文件格式:ZIP
更新时间:2021-05-04 09:48:15
JavaScript
选择随机
从列表中选择随机项目
对于做出决定,选择获胜者或其他任何随机性都可以帮助您的事情很有用。
安装
$ npm install pick-random
用法
const pickRandom = require ( 'pick-random' ) ;
pickRandom ( [ 'Sindre' , 'Stephen' , 'Unicorn' , 'Pascal' , 'Addy' , 'Pony' ] , { count : 2 } ) ;
//=> ['Unicorn', 'Pony']
pickRandom(输入,选项?)
返回一个Array 。
输入
类型: Array
列表中选择。
选项
类型: object
数数
类型: number 默认值: 1
签数。
必须小于或等于input长度。
有关的
此模块的CLI
【文件预览】:
pick-random-main
----.gitignore(23B)
----package.json(714B)
----.npmrc(19B)
----index.js(455B)
----test.js(627B)
----.github()
--------workflows()
----license(1KB)
----readme.md(707B)
----index.test-d.ts(371B)
----.gitattributes(19B)
----.editorconfig(175B)
----index.d.ts(491B)