It is thread safe in the sense it will still generate random numbers when used by multiple threads.
The Sun/Oracle JVM implementation uses synchronized and AtomicLong as seed to improve consistency across threads. But it doesn't appear to be guarenteed across all platforms in the documentation.
I wouldn't write your program to require such a guarantee, especially as you cannot determine the order in which nextInt()
will be called.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…