I\'m having a function that needs to be executed n=1000 times. This functions does a Monte Carlo style simulation and returns an int as the result.
You don't need to. It is totally okay to access a std::vector from multiple threads, if
So just make sure, you create a vector of size n=1000 and depending on your thread number (1 to 4) you assign elements 0-249, 250-499 etc. to your threads.
So each of your thread computes n/nthreads elements.