I have a weird problem with a Monte Carlo Simulation that I built. It is a nested loop to calculate the expected value of investments (actually Poker Tournaments). To demonstrate, assume that we are talking about heads-up Poker Tournaments, which is equal to a coin flip. Assume that we have a 25% ROI per coin-flip and the buy-in is one, so the EV after 100 (500, 1000) coin-flips is 25 (125, 250) units. The simulation, however, returns 24,6, 123,6 and 246, respectively. The critical line in the code is here:
Randomize
randomnumber = Rnd()
If randomnumber > adjustedITM Then
MC_array(m, n) = -tournamentvariables(k, 6)
Else:
Randomize
MC_array(m, n) = CDec(tournamentstructures(Int(Rnd() * (tournamentvariables(k, 7)) + 1), k) * tournamentvariables(k, 6) * (1 - tournamentvariables(k, 5)) * tournamentvariables(k, 2) - tournamentvariables(k, 6))
End If
The 2nd MC_array(m, n) is the critical line of code. It gives the net profit if the player wins. In case of a coin flip this is one unit. If I change the second line to
Randomize
If Rnd() > adjustedITM Then
MC_array(m, n) = -tournamentvariables(k, 6)
Else:
Randomize
MC_array(m, n) = 1
End If
The results are correct. The code after the 2nd MCarray simpliefies for the coin-flip to:
CDec(tournamentstructures(Int(Rnd() * (tournamentvariables(k, 7)) + 1), k) * tournamentvariables(k, 6) * (1 - tournamentvariables(k, 5)) * tournamentvariables(k, 2) - tournamentvariables(k, 6))
=
CDec(tournamentstructures(1,1) * 1 * (1 - 0%) * 2 - 1)
So it is exactly the same as one. The array tournamentstructures() has the size (1,1), so it can't read anything in. I verified that all results are integers (as for a coin flip you can only win or lose a unit), I strongly suspect that the random number generator is somehow biased.
I declared pretty much everything in the code as variant, and excluded the second Randomize without it changing the bias. So guys, what is going here?