<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
以下是测试显示12位的随机数:
asp纯数字随机数:<%=qwbm_shuijima(18,1)%>
asp小写字母随机数:<%=qwbm_shuijima(18,2)%>
asp大写字母随机数:<%=qwbm_shuijima(18,3)%>
asp数字、小写字母、大写字母随机数:<%=qwbm_shuijima(18,0)%>
以下是测试显示36位的随机数:
asp纯数字随机数:<%=qwbm_shuijima(36,1)%>
asp小写字母随机数:<%=qwbm_shuijima(36,2)%>
asp大写字母随机数:<%=qwbm_shuijima(36,3)%>
asp数字、小写字母、大写字母随机数:<%=qwbm_shuijima(36,0)%>
<%
'(取指定长度随机字符串 ,0:数字+大小写字母;1:数字 2:小写;2:大写)
Function qwbm_shuijima(sj_length,sj_mode)
sj_mima_shuzi = "0123456789" '数字
sj_mima_xiaoxie = "abcdefghijklmnopqrstuvwxyz" '小写字母
sj_mima_daxie = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" '大写字母
Select Case sj_mode
Case 1:sj_mima_data = sj_mima_shuzi
Case 2:sj_mima_data = sj_mima_xiaoxie
Case 3:sj_mima_data = sj_mima_daxie
Case else:sj_mima_data = sj_mima_shuzi & sj_mima_xiaoxie & sj_mima_daxie
End Select
sj_j = Len(sj_mima_data)
Randomize(Timer)
For i = 1 To sj_length
sj_sow = sj_sow & Mid(sj_mima_data, Int(sj_j * Rnd + 1), 1)
Next
qwbm_shuijima = sj_sow
End Function
%>