参考下面的,下面的是20取4
CLEAR
RAND(-1)
num = 20*19*18*17 / (4*3*2*1) + 1
local n,ab[2,num],a1[2,num],a2[2,num],a3[2,num],a4[2,num]
FOR x=1 TO 20
ab[x]=INT(RAND()*20+1) && 1 到20的随机数
ENDFOR
n=1
for x=1 to 20-3
for j=x+1 to 20-2
for k=j+1 to 20-1
for m=k+1 to 20
a1[1,n]='A'+TRANSFORM(x)
a2[1,n]='A'+TRANSFORM(j)
a3[1,n]='A'+TRANSFORM(k)
a4[1,n]='A'+TRANSFORM(m)
a1[2,n]=ab[x]
a2[2,n]=ab[j]
a3[2,n]=ab[k]
a4[2,n]=ab[m]
n=n+1
endfor
endfor
endfor
endfor
?"N=",n
CREATE CURSOR tb(a1 C(6),a2 C(6),a3 C(6),a4 C(6),a5 L,a6 i,a7 i,a8 i,a9 i,a10 i)
nVal=0
FOR x =1 TO n-1
nVal = a1[2,x]+a2[2,x]+a3[2,x]+a4[2,x]
INSERT INTO tb(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) ;
VALUES (a1[1,x],a2[1,x],a3[1,x],a4[1,x],BETWEEN(nVal,30,60),a1[2,x],a2[2,x],a3[2,x],a4[2,x],nVal)
ENDFOR
BROWSE