I have a strange problem with the Monte Carlo simulation that I built. This is a nested loop to calculate the expected value of the investment (actually Poker Tournaments). To demonstrate, suppose we are talking about heads-up poker tournaments, which is equal to a coin. Suppose we have 25% ROI for a coin flip, and the buy-in is one, so the EV after 100 (500, 1000) coin transfers is 25 (125, 250) units. The simulation, however, returns 24.6, 123.6, and 246, respectively. The critical line in the code:
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 second MC_array (m, n) is the critical line of code. This gives a net profit if the player wins. In the event of a coin flip, this is one unit. If I changed 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. Code after the 2nd MCarray simplicity for transferring coins:
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)
Thus, he is exactly the same as one. An array of tournament objects () has a size of (1,1), so it cannot read anything. I checked that all results are integers (for example, for a coin flag you can win or lose one), I strongly suspect that the random number generator is somehow biased.
I proclaimed almost everything in the code as an option and excluded the second Randomize, without changing the offset. So guys, what's going on here?