This is the code that I wrote for my final project in Upper Secondary School(SWE=Gymnasieskola) where I went to the Natural Science Program. The goal for the project was to study a few ways to approximate PI and this is my simulation of Buffon's needle. The approximation of PI from this simulation usually ranges between 3.13-3.17 and occasionally it gets very close to PI. The code also gets several averages.
The code is definetly not optimized since I was only going to be using it for this project. There are also a lot of nested for loops :(