优化一下
'context: sub or function
Dim tmps As String
tmps="|"
Randomize 'initialize the random generator
Dim i As Integer,tmpI As Integer
Do ' 原 For i=1 to 10
Tmpi=Int((100 - 1 + 1) * Rnd + 1)
If Instr(1,tmps,"|" & Tmpi & "|")=0 Then
tmps=tmps & tmpi & "|"
End If
Loop Until UBound(split(tmps,"|"))=12 '12=10+2 ' 原 Next
Dim result() As Integer
Result=split(tmps,"|")
'当然也可以用空格代替"|"
[此贴子已经被作者于2007-8-21 18:19:35编辑过]