Correct logic in Monty Hall Problem?
You know it is not running correctly, the ratio is supposed to be 66%, not 50%.... what you really want is some help debugging it.....

Your issue is in your random number generation.... you are only ever setting, and choosing 2 of the three doors. Have a look at this common problem:

https://stackoverflow.com/questions/363681/generating-random-numbers-in-a-range-with-java

You are not using the ranges properly:

    //door range
    int min = 1;
    int max = 3;
    //generate random correct door
    Random r = new Random();
    int i = r.nextInt(max - min) + min;


in this code, max-min is 2, and nextInt(2) is going to be either 0, or 1., add that to min you get either 1 or 2.

You should not care about the min and max, you should just use:

int i = r.nextInt(doorcount); // assuming doorcount == 3


which will return 0, 1, or 2

If you fix this in both the getGuess and getDoors method then you will get the correct ratio of 66%.

Your code has a number of other problems too.


there is no need to create a new Random instance each time you want a random number. Create a single instance and share it.
do not call your method run. This will lead to confusion with the java.lang.Runnable interface
the line: double ratio = wins / wins + losses does not do what you think it does.


I think you should fix your program, then resubmit it for review....