Today we explored one of the amazing ways that pi crops up where you wouldn’t expect it.
We were inspired by this video to write a program in Trinket that simulated a random walk.
The rules are that you start at the origin and toss a coin. If you get a Head you go to the right by one, if you get a Tail you go to the left by one. If you did this for say 1000 steps, 1000 times, the average final position would be 0. But what would if we took the positive distance from the origin at each stage and averaged those values? It involves pi! Watch the video for more info.