<%
Private Function MkPassword(byVal length)
Const specchars = "@#$?_-\/*&"
Const alphabetnumbers = _
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
Dim max, loc, i, a, tmp
Dim wordarray()
If IsNumeric( length ) Then
max = 62 : loc = alphabetnumbers
Else
MkPassword = Null
Exit Function
End If
tmp = ""
For i = 1 to CInt( length - 1 )
Randomize
a = CInt( Rnd * Max ) + 1
Randomize
a = CInt( Rnd * a ) + 1
if a > Max or a < 1 then a = 3
tmp = tmp & Mid( loc, a, 1 )
Next
tmp = StrReverse( tmp )
Randomize
a = CInt( Rnd * 10 ) + 1
if a > 10 then a = 1
loc = specchars
tmp = tmp & Mid( loc, a, 1 )
Redim wordarray( length )
for i = 1 to len( tmp )
wordarray( i - 1 ) = Mid( tmp, i, 1 )
next
tmp = ""
for i = 0 to ubound( wordarray ) step 2
if i > ubound( wordarray ) then exit for
tmp = tmp & wordarray( i )
next
for i = 1 to ubound( wordarray ) step 2
if i > ubound( wordarray ) then exit for
tmp = tmp & wordarray( i )
next
MkPassword = cstr( strReverse( tmp ) )
End Function
%>