asp【vbscript】随机函数
好多年前珍藏的,刚开始asp时珍藏的asp函数
第一个:
Function RndNumber(MaxNum,MinNum)
Randomize
RndNumber=int((MaxNum-MinNum+1)*rnd+MinNum)
RndNumber=RndNumber
End Function
response.write RndNumber
第二个
Function getCode(iCount)
Dim arrChar
Dim j,k,strCode
arrChar = "-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
k=Len(arrChar)
Randomize
For i=1 to iCount
j=Int(k * Rnd )+1
strCode = strCode & Mid(arrChar,j,1)
Next
getCode = strCode
End Function
response.write getcode(100)