Generating random number inside a paralleled loop (openmp)
Generating good random numbers is a hard problem, and generating parallel random numbers is harder. (Consider that you don't want to replicate the same sequence in different threads). You should use a library which provides a parallel random number generator (such as Intel MKL [now free for anyone]). It has an implementation of the generator described in Parallel Random Numbers: As Easy as 1, 2, 3 which may be appropriate.