@@ -0,0 +1,298 @@
+from numpy import random%0Aimport math%0A%0AL = 2%0Ad = L * 2%0A%0Acount = 100000%0Aoverlapped = 0%0A%0Afor _ in range(count):%0A    thita = random.rand() * math.pi%0A    y = random.rand() * (d / 2)%0A%0A    if y %3C= (L / 2) * math.sin(thita):%0A        overlapped += 1%0A%0Ap = overlapped / count%0A%0Aprint(f%22p = %7Bp%7D, pi = %7B1 / p%7D%22)%0A

Add Buffonの針