<%
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
%>