ASP generates random string (numbers + uppercase/lowercase letters) Code
Source: Internet
Author: User
<%
'Asp generates random strings (numbers + uppercase/lowercase letters)
'I don't think I 'd like to use this exercise.
Function randkey (OBJ)
Dim char_array (80)
Dim temp
For I = 0 to 9
Char_array (I) = CSTR (I)
Next
For I = 10 to 35
Char_array (I) = CHR (I + 55)
Next
For I = 36 to 61
Char_array (I) = CHR (I + 61)
Next
Randomize
For I = 1 to OBJ
The random number returned by the 'rnd function is 0 ~ Between 1, can be equal to 0, but not equal to 1
'Formula: int (upper limit-lower limit + 1) * RND + lower limit) can be used to obtain the number from the lower limit to the upper limit, which can be equal to the lower limit but cannot be equal to the upper limit.
Temp = temp & char_array (INT (62-0 + 1) * RND + 0)
Next
Randkey = temp
End Function
Response. Write (randkey (6 ))
%>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service