I recently came across an interesting math problem on youtube (why youtube keeps showing me these when I’m watching cooking shows, I’ll never understand, but I digress). What is the average distance between two random points on a circle? This can also be expanded to ask what is the average distance between two random points inside a circle? Now of course I’m not going to sit down and do lots of math to figure this out, but it is a kinda interesting problem for a monte carlo simulation. So I dusted the python off and went to work.
About a year ago one of my friends introduced me to the online trivia LearnedLeague (LL for short). You have to be invited by a current member but then you are assigned a “rundle” or group of people about your level to play against and answer trivia, etc, etc. We not have 8 different friends playing and have a groupme chat going to discuss answers each day (after submitting of course). But it got kinda annoying to log in to LL each morning and navigate to the four different rundles we’re in to see the results or compare us amongst ourselves. So I used my web scraping and python to do it for me!
Have you heard of Fizz Buzz? It’s commonly used as an basic software interview question or an intro programming example. It’s based on a game meant to teach children division and goes like this. The children sit in a circle and count up from one; but, if your number is divisible by 3 you say “Fizz” instead of your number and if your number is divisible by 5 you say “Buzz” instead of your number. If your number is divisible by both 3 and 5 you say “Fizz Buzz”.
Many of you are familiar with the Birthday Paradox. If you want to read more about it you can find a good article here. Basically, it says that in a room of 23 people, there is a 50% chance that at least two people share a birthday. And if you increase that number to 75 people, the chances go up to 99.9%. I wanted to explore this a little more and rather than doing the math (boring!), I decided to do a Monte Carlo simulation, run it a bunch of times, and plot the results.