1.0.3 • Published 6 years ago

random-tool v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago
var randomTool = require('randomTool');

/**
 * 随机数字函数
 * @第一个参数  min最小值(必传)
 * @第二个参数  max最大值(必传)
 */

// 1.打印1-10之间的随机数字(eg1)
console.log(randomTool.randomNum(1, 10)) // output: 3
// 2.打印1-100之间的随机数字(eg2)
console.log(randomTool.randomNum(1, 100)) // output: 78


/**
 * 随机字符串函数
 * @第一个参数  true使用任意长度,false固定长度(若为固定长度字符串只需传入两个参数,如:false, 6;得到的结果为6位的随机字符串)(必传)
 * @第二个参数  min最小长度(必传)
 * @第三个参数  max最大长度(选传)
 */

// 1.打印任意长度的随机字符串(eg1)
console.log(randomTool.randomString(true, 1, 10)) // output: EMQEmdgx
// 2.打印任意长度的随机字符串(eg2)
console.log(randomTool.randomString(true, 3, 10)) // output: (至少三位最多十位的随机字符串)
// 3.打印固定长度的随机字符串
console.log(randomTool.randomString(false, 6)) // output: frzmCG
1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago