<%
'ASP生成隨機字符串(數字+大小寫字母)練習
'阿會楠練習,為我所用,非我所想
Function randKey(obj)
Dim char_array(80)
Dim temp
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
For i = 1 To obj
'rnd函數返回的隨機數在0~1之間,可等於0,但不等於1
'公式:int((上限-下限+1)*Rnd+下限)可取得從下限到上限之間的數,可等於下限但不可等於上限
temp = temp&char_array(int(62 - 0 + 1)*Rnd + 0)
Next
randKey = temp
End Function
Response.Write(randKey(6))
%>