Simulation of Buffon's needle