Random | string | random | String The 13-bit random string This instance generates is: Rjnvy1gcne7f7
Source:
<%@ LANGUAGE = VBScript%>
<title>
Generate a random string
</title>
<body>
<%
Function Gen_key (digits)
' Define and initialize the array
Dim Char_array (80)
' Initialize the number
For i = 0 to 9
Char_array (i) = CStr (i)
Next
' Initialize uppercase letters
For i = ten to 35
Char_array (i) = Chr (i + 55)
Next
' Initialize lowercase letters
For i = 61
Char_array (i) = CHR (i + 61)
Next
Randomize ' Initializes a random number generator.
Do While Len (output) < digits
num = Char_array (Int (62-0 + 1) * Rnd + 0))
Output = output + num
Loop
' Set return value
Gen_key = output
End Function
' Return the results to the browser
Response.Write "The 13-bit random string generated by this instance is:"
Response.Write "<center>"
Response.Write Gen_key (13)
Response.Write "</center>"
%>
</body>
Because the next learning Channel is used are HTML pages do not normally demonstrate the actual effect of ASP code, if you want to see the actual effect, please copy the code preview.