import random


def simulation(numPoints):
    """Calculates an approximation to pi via the Monte Carlo method
        
        Args:
            text: Number of points
            
        Returns:
            Approximation to pi
        
        Raises:
            None
    """
    in_circle = 0
    total = 0

    for _ in range(numPoints):
        x = random.uniform(0,2)
        y = random.uniform(0,2)
    
        d = (x-1)**2 + (y-1)**2
        if d <= 1.0:
            in_circle = in_circle + 1
        total = total + 1
    
    ans = 4 * in_circle/total
    return ans