Copy Code code as follows:
<%
Randomize
Do While Len (pass) <12 ' random number of digits
Num1=cstr (CHR (57-48) *rnd+48)) ' 0~9
Num2=cstr (CHR (90-65) *rnd+65)) ' A~z
Num3=cstr (CHR (122-97) *rnd+97)) ' A~z
Pass=pass&num1&num2&num3
Loop
%>
<%=pass%>
1, the role of less than the number is actually small equal to the role
2, the book said that the formation of a range of random number formula is
(< upper >-< lower >+1) *rnd+< lower limit >
But the actual operation result is: lower limit--upper limit +1
(< upper >-< lower limit >) *rnd+< the lower bound > is the correct
3, the generation of random password for each 3-digit group, the first digit, the second is a capital letter, the third is a lowercase letter, which master can tell me how to let random number of positions is also random?
Copy Code code as follows:
<%
Sub SjS (N)
Randomize
Response.Write Int (rnd*n)
End Sub
' N is the maximum value of a random number
%>