Is it valid to share one instance of the Random
class between multiple threads? And to call nextInt(int)
from multiple threads in particular?
The Random
class is not set up for one instance to be used in multiple threads. Ofcourse, if you did this, likely you will increase the possibility of getting un-predictable and closer to random numbers. But since it is a pseudo-random generator, I cannot see why you would need to share an instance. Is there a more specific requirement?