生成7位随机数字的js

<script>
var str="qwertyuiopasdfghjklmnbvcxz1234567890"
function getRandomNum(lbound, ubound) {
return (Math.floor(Math.random() * (ubound - lbound)) + lbound);
}
var s=str.split("");
var t="";
for (var i=0;i<7;i++){
t+=s[getRandomNum(1,36)];
}
alert(t)
</script>

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页