美文网首页
生成随机数+

生成随机数+

作者: 暴躁的狮子头 | 来源:发表于2019-04-02 12:07 被阅读0次

生成随机序列
用法:

$ npm install --save randomatic

var randomize = require('randomatic');

randomize(pattern, length, options);

eg:
randomize('*', 10);
//=> 'x2_^-5_T[$'
 
randomize('Aa0!', 10);
//=> 'LV3u~BSGhw'

生成长度为100的数组,每个元素为0:

    const record = Array.apply(null, Array(100)).map(() => {
      return 0;
    });

相关文章

网友评论

      本文标题:生成随机数+

      本文链接:https://www.haomeiwen.com/subject/krstwftx.html