From The Compiler, 7 Years ago, written in Python.
Embed
  1. #!/usr/bin/python3
  2. # vim: set fileencoding=utf-8 ts=4 sts=4 sw=4 tw=80 expandtab :
  3. import random
  4. inside = 0
  5. total = 0
  6. for i in range(0, 50000000):
  7.     px = random.random()
  8.     py = random.random()
  9.     total += 1
  10.     if (px**2 + py**2 >= 1):
  11.         inside += 1
  12. pival = 4 * (inside / total)
  13. print(pival)