Skip to content

declerckt/simple-monty-hall-problem-java-implementation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Little MONTY HALL PROBLEM implementation using java

Hi! this is just a little single class monty hall problem implementation using Java. Using this class you are able to define a number of loop you want for your test. The result of the execution is the number of victories depending on whether you decide to change your choice or not and the execution time.

Return example

--- Little MONTY HALL PROBLEM implementation ---
Number of victories depending on whether you decide to change your choice or not (based on 10000000 tries) :
If you changed your choice : 6665640 (66,00%)
If you kept your choice : 3334360 (33,00%)
Execution time : 304ms

How to

to compile

javac MhpImpl.java

to execute

java MhpImpl [number of loops]

Run with Docker

docker build -t mhp .
docker run --rm mhp [number of loops]

Note if not precised the default number of loops is 10000.