ASP to generate random number of digits, uppercase letters, lowercase letters specified number of digits _ Application Tips

Source: Internet
Author: User
Tags lowercase
<%
'******************************
' Function: Gen_key (digits)
' Parameters: digits----number of digits to generate random numbers
' Author: Arisisi
' Date: 2007/7/13
' Description: Generates a random number with digits, uppercase letters, and lowercase letters specifying digits; return value: Random number of specified multiples to generate
' Example: <%=gen_key (8)%>
'******************************
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
%>
Related Article

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.