npm

your-rand-int

0.2.0 • Public • Published

your-rand-int

npm i your-rand-int

randInt(min, max)

获取指定范围的随机整数

import randInt from 'your-rand-int'

// 正常传入 [10, 20]
randInt(10, 20)

// 支持负数 [-10, 20]
randInt(-10, 20)

// 从大到小 [20, 30]
randInt(30, 20)

// 带小数和字符串的参数,会自动转为整数 [-1, 3]
randInt(3.1, '-1.2')

Readme

Keywords

none

Package Sidebar

Install

npm i your-rand-int

Weekly Downloads

97

Version

0.2.0

License

MIT

Last publish

Collaborators

  • weiyou