Just for fun, the monty hall problem in ruby. Runs simulation one million times. def monty_hall(switch) results = {switching: switch, wins: 0, losses: 0, count: 0, win_percentage: 0} (10**6).times.each do |n| prizes = [0,0,1].shuffle initial_selection = (0..2).to_a.sample other_doors = (0..2).to_a – [initial_selection] goat = other_doors.select{|n| prizes[n]==0}.sample available_selections = [initial_selection, (0..2).to_a – [initial_selection, goat]].flatten if switch […]

## Monty Hall Problem in Ruby

- Post author By anthony
- Post date
- Categories In Ruby, Statistics
- No Comments on Monty Hall Problem in Ruby