First, using a single (main) thread, generate random numbers (taking advantage of C++11 features) to raise exceptions at random time. For example, something along these lines:
main() {
for (size_t i = 0; i
Next, we can start N threads with a code similar to the above, and the exception message can include the thread ID. The main loop must wait for the competion of all the treads.