Hi,
I wanted to generate random numbers, but they need to be the same random numbers. So in C++ I recall you could seed the random number generator with an integer.
So Rnd(8) should generate the same sequence of numbers. How do we do this in Excel?
I notice that if I use Rnd(8) it generates the same ones but they are the same as Rnd(9) etc...
I wanted to generate random numbers, but they need to be the same random numbers. So in C++ I recall you could seed the random number generator with an integer.
So Rnd(8) should generate the same sequence of numbers. How do we do this in Excel?
I notice that if I use Rnd(8) it generates the same ones but they are the same as Rnd(9) etc...
VBA Code:
Sub test_array()
Dim x1(1 To 100, 1 To 200) As Double
Dim i As Integer, j As Integer
For i = 1 To 100
For j = 1 To 200
x1(i, j) = Rnd(8)
Range("G5").Offset(j, 0).Value = x1(i, j)
Next j
Next i
'1.) seed random number
End Sub