<%
Dim arr,result,i,j,k,fs,kk,key
set fs=server.createobject("scripting.filesystemobject")
arr=Split("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z",",")
rem -----------------取所有不重复的2个字符组合-------------------------
k=-1
For i=0 To UBound(arr)
    For j=0 To UBound(arr)
        If i<>j then
            k=k+1
            If k=0 Then
                ReDim result(k)
            else
                ReDim Preserve result(k)
            End if
            result(k)=arr(i)&arr(j)
        End if
    next
Next
fs.createtextfile(server.mappath("1.txt"),true).write Join(result,vbcrlf)
rem ------------------------------------------
rem -----------------生成k个不重复的2个字符组合------------------------
k=100
kk=0
Set result=Server.createObject("Scripting.Dictionary")
Do While kk<k
    i=Int(26*Rnd)
    j=Int(26*Rnd)
    If i<>j And Not result.Exists(arr(i)&arr(j)) then
        kk=kk+1
        result.add arr(i)&arr(j),arr(i)&arr(j)
    End if
Loop
If fs.FileExists(server.mappath("2.txt")) then
    fs.deletefile server.mappath("2.txt")
End If
fs.createtextfile(server.mappath("2.txt"),true).write ""
For Each key in result
    fs.OpenTextFile(server.mappath("2.txt"),8,true).writeline key
Next
rem---------------------------
Set fs=nothing
%>
本文作者:博主: 文章标题:【ASP代码】26个字母,随机取两个字母,任意组合,输出。
本文地址:https://bird.work/index.php/archives/532/
版权说明:若无注明,本文皆为“BIRD.WORK”原创,转载请保留文章出处。
最后修改:2021 年 03 月 04 日 03 : 38 PM
如果觉得我的文章对你有用,请随意赞赏