?? random.asp
字號:
<%@ LANGUAGE = VBScript %>
<html>
<title>
生成隨機字符串
</title>
<body>
<%
Function gen_key(digits)
'定義并初始化數(shù)組
dim char_array(80)
'初始化數(shù)字
For i = 0 To 9
char_array(i) = CStr(i)
Next
'初始化大寫字母
For i = 10 To 35
char_array(i) = Chr(i + 55)
Next
'初始化小寫字母
For i = 36 To 61
char_array(i) = Chr(i + 61)
Next
Randomize '初始化隨機數(shù)生成器。
do while len(output) < digits
num = char_array(Int((62 - 0 + 1) * Rnd + 0))
output = output + num
loop
'設(shè)置返回值
gen_key = output
End Function
'把結(jié)果返回給瀏覽器
response.write "本實例生成的十三位隨機字符串為:"
response.write "<center>"
response.write gen_key(13)
response.write "</center>"
%>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -