欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

如何编制一个产生随机密码的函数?

程序员文章站 2022-04-15 09:25:44
<%response.write makepassword(16)function makepasswor...
<%
response.write makepassword(16)

function makepassword(byval 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
        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
%>

[1]