如何实现,在1-33之间取6个数为一组,6个数从小到大排列,且不能重复,然后把所有可能列表 寻求VB代码

在1-33之间,取任意6个数,从小到大排列,不能重复,然后把所有可能列表
请用VB给出代码
我运行过了,不对呀,好像太少了 1-33任意选6个为一组 不重复的 应该有(33*32*31*30*29*28)/(
6*5*4*3*2*1)=1107568个,可我现在就几百个啊.

典型的双色球啊
太简单了啊
如果你需要把所有可能都列表的话
都不需要随机生成数组
只需要循环就可以了
温馨提示:答案为网友推荐,仅供参考
第1个回答  2007-12-13
Dim a(6) As Integer

Dim i As Integer
Dim j As Integer

Private Sub Form_Load()
For i = 0 To 5
a(i) = i + 1

Next i
i = i - 1
Call getallserial

End Sub
Private Function getallserial()
handle:
If a(i) < 33 - 6 + i Then
a(i) = a(i) + 1
Debug.Print a(0) & a(1) & a(2) & a(3) & a(4) & a(5)
GoTo handle:
Else
If i > 0 Then
i = i - 1
Call getallserial
Else
Exit Function
End If
End If
End Function
我运行过了,没问题
相似回答