[ASP][Function]Get n Random Code-String in (A~Z,a~z,0~9)

產生 n 亂數字串碼 (A~Z,a~z,0~9)

 

'Get_Code(n)  

function Get_Code(num)
    Randomize    
    do while len(Code)<num
  N=Cint(Rnd*10*second(now)) MOD 62
  if N>=0 and N<=9 then  
      Code = Code & chr(N+48)
  elseif N>=10 and N<=35 then
      Code = Code & chr(N+65-10)
  elseif N>= 36 and N<=61 then  
      Code = Code & chr(N+97-36)
  end if
    loop
    Get_Code=Code
End function