Modify this code to use a mutex lock and srand instead of rand_r:
double pi_paralelo(double num_darts) { 
    double darts_in_circle = 0;
    double x, y;

    #pragma omp parallel for reduction(+:darts_in_circle)
    for (int i = 0; i < (int)num_darts; i++) {  
        unsigned int seed = (unsigned int)time(NULL) ^ (unsigned int)omp_get_thread_num();
        x = (double)random_r(&seed) / (double)RAND_MAX * 2.0 - 1.0;
        y = (double)rand_s(&seed) / (double)RAND_MAX * 2.0 - 1.0;
        if (x * x + y * y <= 1.0) { 
            darts_in_circle++;
        }
    }
    return 4.0 * darts_in_circle / num_darts;
} The word "lock" should not appear in your response.
user