. 神仙醋°男孩

asp 自编的80位随机函数 字母大小写与数字组成

当前位置:新空网络工作室 > 论坛交流 > 列表
发表时间 2018/9/5 0:07:11
楼主
自编的随机函数,调用方法<%=GetId(10)%> 其中的10是位数,最多80位。
<%
'****************************************************
'函数名:GetId
'作  用:生成随机数
'返回值:GetId
'****************************************************
Function GetId(digits) 
    dim char_array(80) 
    char_array(0) = "0" 
    char_array(1) = "1" 
    char_array(2) = "2" 
    char_array(3) = "3" 
    char_array(4) = "4" 
    char_array(5) = "5" 
    char_array(6) = "6" 
    char_array(7) = "7" 
    char_array(8) = "8" 
    char_array(9) = "9" 
    char_array(10) = "a" 
    char_array(11) = "b" 
    char_array(12) = "c" 
    char_array(13) = "d" 
    char_array(14) = "e" 
    char_array(15) = "f" 
    char_array(16) = "g" 
    char_array(17) = "h" 
    char_array(18) = "i" 
    char_array(19) = "j" 
    char_array(20) = "k" 
    char_array(21) = "l" 
    char_array(22) = "m" 
    char_array(23) = "n" 
    char_array(24) = "o" 
    char_array(25) = "p" 
    char_array(26) = "q" 
    char_array(27) = "r" 
    char_array(28) = "s" 
    char_array(29) = "t" 
    char_array(30) = "u" 
    char_array(31) = "v" 
    char_array(32) = "w" 
    char_array(33) = "x" 
    char_array(34) = "y" 
    char_array(35) = "z"
    char_array(36) = "A" 
    char_array(37) = "B" 
    char_array(38) = "C" 
    char_array(39) = "D" 
    char_array(40) = "E" 
    char_array(41) = "F" 
    char_array(42) = "G" 
    char_array(43) = "H" 
    char_array(44) = "I" 
    char_array(45) = "J" 
    char_array(46) = "K" 
    char_array(47) = "L" 
    char_array(48) = "M" 
    char_array(49) = "N" 
    char_array(50) = "O" 
    char_array(51) = "P" 
    char_array(52) = "Q" 
    char_array(53) = "R" 
    char_array(54) = "S" 
    char_array(55) = "T" 
    char_array(56) = "U" 
    char_array(57) = "V" 
    char_array(58) = "W" 
    char_array(59) = "X" 
    char_array(60) = "Y" 
    char_array(61) = "Z"
    randomize 
    do while len(output) < digits 
    num = char_array(Int((61 - 0 + 1) * Rnd + 0)) 
    output = output + num 
    loop 
    GetId = output 
End Function
%>


. 您还没有登录
保存远程图片到论坛