随机生成数字字母

来源:互联网 发布:php就业前景 编辑:程序博客网 时间:2024/06/10 17:32

Function makePassword(maxLen)
Dim strNewPass
Dim whatsNext, upper, lower, intCounter
Randomize
For intCounter = 1 To maxLen
whatsNext = Int((1 - 0 + 1) * Rnd + 0)
If whatsNext = 0 Then
'character
upper = 90
lower = 65
Else
upper = 57
lower = 48
End If
strNewPass = strNewPass & Chr(Int((upper - lower + 1) * Rnd + lower))
Next
makePassword = strNewPass
End Function 

'随机产生编号

 numaz="" dim num20(19)

 For j=0 to 19

 Do

 Randomize

asciicode=Int((122 - 48 + 1) * Rnd + 48)

Loop Until asciicode<=57 or (65<=asciicode and asciicode<=90) or 97<=asciicode

num20(j)=chr(asciicode)

Next

numaz=Join(num20,"")
 

原创粉丝点击