国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

ASP隨機(jī)生成漢字

2019-11-17 04:12:44
字體:
供稿:網(wǎng)友

<%Dim i
    Dim j
    Dim HS
    Dim HE
    Dim LS
    Dim LE
    dim Result
    Result=""
    HS = 177
    HE = 247
    LS = 161
    LE = 254
    dim Max_Num
    Max_num=65536
    Randomize  
    For i = 1 To 4
temp1=dec2bin(Int((HE - HS) * Rnd()) + HS)
temp2=dec2bin(Int((LE - LS) * Rnd()) + LS)
        Result = Result & chr(BinaryToDecimal(temp1 & temp2) - Max_num)

    Next
    response.write Result & " "
%>
<%
    ''下面是函數(shù)
''-------------------------------------------
Public Function dec2bin(mynum)''十進(jìn)制到二進(jìn)制
Dim loopcounter
If mynum >= 2 ^ 31 Then
dec2bin = "Too big"
Exit Function
End If
Do
If (mynum And 2 ^ loopcounter) = 2 ^ loopcounter Then
dec2bin = "1" & dec2bin
Else
dec2bin = "0" & dec2bin
End If
loopcounter = loopcounter + 1
Loop Until 2 ^ loopcounter > mynum
End Function
''-------------------------------------------
Public Function BinaryToDecimal(BinaryValue) ''二進(jìn)制到十進(jìn)制的轉(zhuǎn)換
'' Returns the decimal equivalent of a binary number
Dim idx
Dim tmp
Dim result
Dim digits
digits = Len(BinaryValue)
For idx = digits To 1 Step -1   
    tmp = Mid(BinaryValue, idx, 1)
    If tmp = "1" Then result = result + 2 ^ (digits - idx)
Next
BinaryToDecimal = result

End Function
%>


發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 河间市| 梁山县| 缙云县| 铜山县| 关岭| 杭锦后旗| 枞阳县| 吴旗县| 镇平县| 大理市| 扬中市| 长宁县| 云龙县| 昭觉县| 武汉市| 黑山县| 肥乡县| 呼玛县| 台东县| 丹寨县| 资溪县| 哈密市| 乐清市| 沅陵县| 华池县| 南城县| 建瓯市| 大悟县| 靖安县| 北票市| 临猗县| 鸡泽县| 疏勒县| 营山县| 西畴县| 麟游县| 榆树市| 哈尔滨市| 社会| 舒兰市| 唐山市|