ASP Instance Learning: A function of randomly generating file names

Source: Internet
Author: User
Tags generator

 

<meta http-equiv= "Refresh" content= "2" >


<!--


Place this code to an ASP Page and run it!


-->


<code>


Random FileName creation





<%


Function Generator (Length)


Dim i, TempS, v


Dim C (
)

TempS = ""


C (1) = "A": C (2) = "B": C (3) = "C": C (4) = "D": C (5) = "E": C (6) = "F": C (7) = "G"


C (8) = "H": C (9) = "I": C (a) = "J": C (one) = "K": C (a) = "L": c () = "M": C () = "n"


c = "O": c = "P": C (m) = "Q": C (m) = "R": C (P) = "s": C (m) = "T": C (s) = "U"


c = "V": C (k) = "W": C (a) = "X": c (= "Y": c () = "Z": C (m) = "1": c () = "2"


(c) = "3": c = "4": C (to) = "5": C (m) = "6": C (m) = "7": C () = "8": C (+) = "9"


c = "-": C (Panax Notoginseng) = "_": C () = "@": C (d) = "!"


If isnumeric (Length) = False Then


Response.Write "A Numeric datatype is not submitted to this function."


Exit Function


End If


for i = 1 to Length


Randomize


v = Int ((Rnd) + 1)


TempS = TempS & C (v)


Next


generator = TempS


End Function





for i = 1 to


Randomize


x = Int ((Rnd) + 1) +


Response.Write Generator (x) & "<br>" & vbNewLine


Next


%>


</code>

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.