# Monte Carlo Simulations & Probability in Ruby

Here are two fun probability puzzles we will solve with little Ruby scripts:

Monty Hall problem - the solution is notoriously counterintuitive, yet it's pretty easy to prove with a quick Ruby program. Solving this empirically is a useful exercise that reminds us to distrust our intuitions and instead use computer programs to demonstrate the correct answer.

Birthday problem - the solution to this one is also surprising to the layman. Familiarity with this problem is useful for understanding hash tables and some areas of cryptography and number theory.

Both problems, no matter how difficult they may be to solve theoretically, are easy to solve in a few lines of code! The use of computer programs to solve problems using repeated trials against random inputs is known as the Monte Carlo method.

Please skim the Wikipedia articles linked above before class.

Be sure to complete the following Codewars challenge before class!
(If your RailsSchool profile includes your Codewars username, you'll get
a nifty star if you complete the challenge.)

http://www.codewars.com/kata/unique-pairs/train/ruby