# utils.py

import random

def estimate_pi_in_task(num_samples):
    """
    Approximate π using Monte Carlo simulation: within a single task, 
    generate num_samples random points uniformly distributed in the unit square, and count how many fall inside the unit circle.
    """
    inside = 0
    for _ in range(num_samples):
        x, y = random.random(), random.random()
        if x*x + y*y <= 1:
            inside += 1
    return inside
