I am trying to create a loop where a randomly generated number is used to determine if a win/loss occurs up to a number of wins. The problem I am having is that when vba uses the RND function to define a variable, it is not generating a new random number after each loop. How can I make it so the win/loss is determined for each loop individually?
The code I am using is:
Sub wins()
Dim i As Integer
Dim j As Integer
Dim z As Variant
j = Rnd()
Do Until i = 26 Or z = 5000
Randomize
If j > 0.55 Then i = i + 1
If j < 0.55 And i = 0 Then i = i
If j < 0.55 And i > 0 Then i = i + 1
z = z + 1
Loop
msgbox z
End Sub