Random not thread-safe


#1

Functions like nextInt() aren't thread safe, which could be a problem for unit tests which create multiple threads. Not sure what the general solution is. In my case, I'm making the Random a data member of each of the test threads.

 


#2

Yep - use copies. That's what I've done in my tests too.