SubtleMustyErne

import random

class RandomPoint:
    """A random point that will lie within a square of side length 2*radius"""

    # Sets the radius of the circle that lies within the square. Then create
    # a randomely positioned point that lies within the square.
    def __init__(self, radius):
        assert (radius > 0)
        self.radius = radius
        self.x = random.randrange(-radius, radius)
        self.y = random.randrange(-radius, radius)

    # Determines if the point lies within the inner circle.
    def PointLiesInCircle(self):
        return pow(self.x, 2) + pow(self.y, 2) <= pow(self.radius, 2)

    def DataPoints(self):
        return [self.x, self.y]
        
piPoints = []

# initialise parameters
numberOfPoints = 200 #Change this to plot more/less points for each simulation.
circleRadius = 100
radiusSquared = pow(circleRadius, 2)
simulationCount = 100 #Change this to run more/less simulations
circleCount = 0

while True:
    # Execute each simulation
    for steps in range(simulationCount):
        circleCount = 0

        # Generate all points for the current simulation
        for points in range(numberOfPoints):
            point = RandomPoint(circleRadius)
            dataPoints = point.DataPoints()

            if point.PointLiesInCircle():
                circleCount += 1

        piPoints.append(4 * circleCount / numberOfPoints)

    avgValueForPi = sum(piPoints)/len(piPoints)
    print(avgValueForPi)