def rand_n(bias)
  rand(bias) == 0? 1: 0
end

def unbiased(bias)
  a, b = rand_n(bias), rand_n(bias) until a!= b 
  a
end

runs = 1_000_000
keys = %i(bias biased unbiased) 
puts keys.join()

(3..6).each do |bias|
  counter = Hash.new(0) 
  runs.times do
    counter[:biased] += 1 if rand_n(bias) == 1 
    counter[:unbiased] += 1 if unbiased(bias) == 1
  end
  counter[:bias] = bias
  puts counter.values_at(*keys).join()
end