我正在尝试创建随机sigma数组。当我调用下面的代码时,它会生成一个包含1000个相同数字的数组,请指教。
Steps = 1000
Dim ArrayRand() As Double
For i = 1 To Steps
ReDim Preserve ArrayRand(1 To Steps)
Randomize
ArrayRand(i) = WorksheetFunction.NormSInv(Rnd)
Next i
答案 0 :(得分:5)
步骤始终为1000
Steps = 1000
Dim ArrayRand(1 to Steps) As Double
For i = 1 To Steps
Randomize
ArrayRand(i) = WorksheetFunction.NormSInv(Rnd())
Next i