标签:func turn function length while tran tco fun ons
<script type="text/javascript">
function getRandom(a,b){
var ary = [];
while(ary.length < 4){
var sss = Math.floor(Math.random()*(b-a)+a);
if(ary.indexOf(sss) == -1){
ary.push(sss);
}
}
return ary;
}
function getCode(){
var str = ‘qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789‘;
var str2 = ‘‘;
var arr = getRandom(0,62);
for(i = 0;i< arr.length;i++){
str2+= str[arr[i]];
}
return str2;
}
var code= getCode();
console.log(code);
</script>
标签:func turn function length while tran tco fun ons
原文地址:https://www.cnblogs.com/xiaohaio/p/9063540.html