Sub lotto()
Dim Fn As Object
Set Fn = Application.WorksheetFunction
For k = 1 To 1000
For i = 1 To 6
Cells(k, i) = Fn.RoundUp(Rnd * 49, 0)
For j = 1 To i - 1
If Cells(k, i) = Cells(k, j) Then i = i - 1
Next
Next
Next
End Sub
如果你有Mathematica的話,那就方便多了
<<>
Table[RandomKSubset[Range[49], 6], {i, 1, 1000}]
這樣就ok~~
讀者回應 ( 0 意見 )
訂閱發佈留言 (Atom)
發佈留言
Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.
如果這篇文章對你有幫助,那請留個訊息給我~