前端js生成任意随机数
// n位随机数生成 function randomNum(n) { let sString = ""; let strings = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; for (i = 0; i < n; i++) { ind = Math.floor(Math.random() * strings.length); sString += strings.charAt(ind); } return sString } 用法: randomNum(16)