JSPM

random-tool

1.0.3
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 1
    • Score
      100M100P100Q25612F
    • License MIT

    randomNum randomString

    Package Exports

    • random-tool

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (random-tool) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    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