The article then describes the Gathering. (I'm on the invite list, but I've not yet been.) It eventually explains the answer, but these probability questions never make sense. So I wrote a program to illustrate the first oddity, which is that announcing you have two children and one is a boy makes the probability of the other one being a boy only 1/3. Basically, create 10,000 sets, and remove any that are two girls. Now count up the total number of pairs left and the total number of those that are two boys, and you end up with something around one-third.
num_bbs = 0
total_pairs = 0
(0...10000).each do |count|
children = [Kernel.rand(2),Kernel.rand(2)]
next if children[0] == 1 && children[1] == 1
total_pairs = total_pairs + 1
num_bbs = num_bbs + 1 if children[0] == 0 && children[1] == 0
end
puts "#{num_bbs} pairs of boys out of #{total_pairs} valid pairs = #{(num_bbs.to_f/total_pairs.to_f) * 100}"
It's weird, but it's true.
No comments:
Post a Comment