Let's see:
- Is code included directly in my question? Yes
- Am I an owner or maintainer of the code? Yes
- Is it actual code from a project rather than pseudo-code or example code? Yes
- Do I want the code to be good code? Yes
- To the best of my knowledge, does the code work? (See below)
- Do I want feedback about any or all facets of the code? Yes
The culprit is: To the best of my knowledge, does the code work?
My definition of does the does work? is: Does it do what it is supposed to do and produce the expected results?
While Monte Carlo may produce some statistically inaccurate results, that's the point of the algorithm.
Let's assume that they were off-topic, then where would programmers go to have code for a Monte Carlo algorithm reviewed? My point exactly. Saying that it is off-topic just because it's Monte Carlo would be silly.
As for how you exactly formulate the question, such as:
- I have this Monte Carlo algorithm, but I am not sure if it is correct or not
- I have this Monte Carlo algorithm, is there a better algorithm to pick?
- I have this Monte Carlo algorithm, how would you have solved it?
- I have this Monte Carlo algorithm, how can the code be improved?
- etc.
That's part of another discussion