Add a note about the Random(...) generators being not thread-safe

This commit is contained in:
Ilya Gorbunov
2020-03-21 03:11:16 +03:00
parent 44ffed9590
commit d7007044c2
@@ -282,6 +282,8 @@ public abstract class Random {
* *Note:* Future versions of Kotlin may change the algorithm of this seeded number generator so that it will return
* a sequence of values different from the current one for a given seed.
*
* On JVM the returned generator is NOT thread-safe. Do not invoke it from multiple threads without proper synchronization.
*
* @sample samples.random.Randoms.seededRandom
*/
@SinceKotlin("1.3")
@@ -295,6 +297,8 @@ public fun Random(seed: Int): Random = XorWowRandom(seed, seed.shr(31))
* *Note:* Future versions of Kotlin may change the algorithm of this seeded number generator so that it will return
* a sequence of values different from the current one for a given seed.
*
* On JVM the returned generator is NOT thread-safe. Do not invoke it from multiple threads without proper synchronization.
*
* @sample samples.random.Randoms.seededRandom
*/
@SinceKotlin("1.3")