'==================================================================
'函数名: MakeRandomizeCode
'作者: easy
'日期: 2005-05-09
'功能: 生成一个永不重复的随机编码 随即数+日期+时+分+秒
'输入参数:无
'返回值: 随机编码
'修改记录:
'==================================================================
Function MakeRandomizeCode()
' 禁止缓存
Randomize
Dim cAmount,cCode,i
cAmount=36 '文字数量
cCode="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
' 随机产生字符
Dim vCode(4), vCodes
For i = 0 To 3
vCode(i) = Int(Rnd * cAmount)
vCodes = vCodes & Mid(cCode, vCode(i) + 1, 1)
Next
tempNum=year(now) & month(now) & day(now) & hour(now) & minute(now) & second(now) &timer()*100&vCodes
if trim(LCase(session("tempRandomizeCode")))=trim(lcase(tempNum)) then tempNum=MakeRandomizeCode()
session("tempRandomizeCode")=tempNum
MakeRandomizeCode=tempNum
End Function