<% Option Explicit %>
<%

' Write a password with random characthers and numberic 

%> 

<Html><head></head><body><p>

This code generates a random password using numbers, uppercase letters, lower case letters or any combination of the three.  </p>
<p>The length of the password can be any length.</p>
<p>The this 20 character password is:<b> 
<%
''''''''''''''''''''''''''''''''''''''''''''''''
' The paramter passed to the function defines
' how long the password will be
'
''''''''''''''''''''''''''''''''''''''''''''''''
Response.Write RandomPW(20) & "<br>" & vbCrLf


Function RandomPW(PasswordLength)

	Dim X, Y, strPW


	For X = 1 To PasswordLength

		''''''''''''''''''''''''''''''''''''''''''''''''''''''
		' Randomize the type of this character 
		' For numbers only, change the 3 to a 1
		' For numbers and Uppercase only, change the 3 to a 2
		'
		''''''''''''''''''''''''''''''''''''''''''''''''''''''

		Y = Int((3 * Rnd) + 1) '(1) Numeric, (2) Uppercase, (3) Lowercase

		Select Case Y
			Case 1
				' Numeric character

				Randomize
				strPW = strPW & CHR(Int((9 * Rnd) + 48))

			Case 2
				' Uppercase character 
				Randomize
				strPW = strPW & CHR(Int((25 * Rnd) + 65))

			Case 3
				' Lowercase character 
				Randomize
				strPW = strPW & CHR(Int((25 * Rnd) + 97))

		End Select
	Next

	RandomPW = strPW

End Function



%>

</b></p>

<%
 Dim strTempPassword		' As String

 Randomize()

 ' where 100M is the lower end of the range and
 ' the 900M is the upper end minus the lower end of the range

 strTempPassword = Int(100000000 + (900000000 * Rnd()))

%>
<p> A 9 digit, numeric random number is <% = strTempPassword %></p>


</body></html>