
Sub
RandomNumbers
()
Dim x(1 To 60) As Integer
For i = 1 To 60x
(i) = i
Next
For j = 1 To 1000
a1 = Int(Rnd() * 60) + 1
a2 = Int(Rnd() * 60) + 1
temp = x(a1)
x(a1) = x(a2)
x(a2) = temp
Next
For l = 1 To 60
Cells(l, 1) = x(l)
Next
End Sub
亂數排序法
Sub RandomNumbers()
Dim Fn As Object
Set Fn = Application.WorksheetFunction
Rnd (-1)
Randomize 10
For i = 1 To 60
Cells(i, 1) = Rnd
Next
For j = 1 To 60
Cells(j, 2) = Fn.Rank(Cells(j, 1), Range("A1:A60"))
Next
End Sub
讀者回應 ( 0 意見 )
訂閱發佈留言 (Atom)
發佈留言
Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.
如果這篇文章對你有幫助,那請留個訊息給我~