code: function randData (o, n) {
    if (!o) {
      return ''
    }
    let a = o instanceof Array ? o : (String(o)).split('')
    let len = a.length - 1
    let str = ''
    for (let i = 0; i < n; i++) {
      str += a[tools.rnd(0, len)]
    }
    return str
  }
docs: console.log(tools.rnd(0,10)) 随机生成长度为n的字符串，参数o为数据源