基础版:
<script>
function DAxie(){
string="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
return string[Math.floor(Math.random()*26)]
}
function XIAOxie(){
string="ABCDEFGHIJKLMNOPQRSTUVWXYZ".toLowerCase
return string[Math.floor(Math.random()*26)]
}
function number(){
string="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
return string[Math.floor(Math.random()*10)]
}
function SIX(){
s=""
for(i=1;i<=6;i++){
v=[DAxie(),XIAOxie(),number()](随机函数集合)
s=s+v[Math.floor(Math.random()*3)]
}
return s
}
</script>
ASCII基础版
<script>
function suiji(){
c=""
v=""
for(i=1;i<=6;i++){
s=Math.floor(Math.random()*75+48)(ASCII码为48-122之间)
if(s<=57){
c=String.fromCharCode(s)(数字与ASCII之间的转换)
}
else if(s>=65&&s<=90){
c=String.fromCharCode(s)
}
else if(s>=97){
c=String.fromCharCode(s)
}
else{
c=""
i=i-1
}
v=v+c
}
return v
}
</script>
ASCII进阶版
<script>
function suiji(){
c=""
v=""
for(i=1;i<=6;i++){
s=Math.floor(Math.random()*75+48)
if(s<=57||s>=97||(s>=65&&s<=90)){
v=v+String.fromCharCode(s)
}
else{
i=i-1(重取ASCII)
}
}
return v
}
</script>
基础版:
ASCII基础版
ASCII进阶版