MkPassword Function:

The MkPassword Function creates a randomized password of a specified length. The required argument, length, specifies how long the password should be in characters. MkPassword automatically inserts one special character (@#$?_-\/*&) in each password. MkPassword returns Null if the required argument, length, is not an Integer.

Syntax:
string = MkPassword( length )
Example Usage:
<%
 ' create a seven character password
response.write MkPassword( 7 )
%>
ASP Source Code:
<%
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
%>