# Demo entry 6065365

**test**

Submitted by **anonymous**
on Sep 23, 2016 at 21:25

Language: Python 3. Code size: 424 Bytes.

def pi_Estimate(numPoints): # Need about 300,000 tests to approximate # pi = 3.14 with around 90% success (of 10 # separate tests). c = 0 t = 0 pi = 0 for point in range(numPoints): x = np.random.uniform(-1, 1) y = np.random.uniform(-1, 1) if math.sqrt(x ** 2 + y ** 2) <= 1: c += 1 t += 1 pi = round(4 * (c / t), 2) return pi

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.