Skip to content

Instantly share code, notes, and snippets.

View kristopolous's full-sized avatar
💣
New releases are coming soon!

chris mckenzie kristopolous

💣
New releases are coming soon!
View GitHub Profile
@kristopolous
kristopolous / MontyHall.rb
Created September 12, 2012 00:36
Monty Hall Simulation done in readable ruby.
#!/usr/bin/ruby
$door_count = 3
$door_list = 0.upto($door_count - 1).to_a
$game_count = 10 * 1000
def percent(numerator, denominator)
return "%5.2f%" %[100 * numerator.to_f / denominator.to_f]
end
@kristopolous
kristopolous / omnilog.rb
Created June 29, 2012 20:46
OmniLogger
class OmniLog
attr_reader :available
def initialize(path)
@real = Logger.new(path)
@fake = Logger.new("/dev/null")
@available = Set.new
end
def add!(which)