ASP generate random strings (numbers + uppercase and lowercase) code _ Application Tips

Source: Internet
Author: User
<%
' ASP generates random strings (numbers + uppercase and lowercase) exercises
' I'll practice for my own use, not what I think.
Function Randkey (obj)
Dim Char_array (80)
Dim Temp
For i = 0 to 9
Char_array (i) = Cstr (i)
Next
For i = ten to 35
Char_array (i) = Chr (i + 55)
Next
For i = 61
Char_array (i) = CHR (i + 61)
Next
Randomize
For i = 1 to obj
The ' Rnd function returns a random number between 0~1, which is equal to 0, but not equal to 1.
' Formula: Int ((upper-bound + 1) *rnd+ lower bound) to obtain a number from the lower bound to the upper limit, which is equal to the lower limit but not equal to the upper limit
temp = temp&char_array (int (62-0 + 1) *rnd + 0)
Next
Randkey = Temp
End Function
Response.Write (Randkey (6))
%>

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.