From bb9e9ac1ee033c9959cc0c7130d065c82847fbac Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Tue, 25 Sep 2018 06:07:38 +0300 Subject: [PATCH] Seeded random docs: add a note about repeatability not being preserved We're not ready to give a guarantee that the seeded generator implementation will never change in future versions. --- libraries/stdlib/src/kotlin/random/Random.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libraries/stdlib/src/kotlin/random/Random.kt b/libraries/stdlib/src/kotlin/random/Random.kt index d17b61272ff..ca0c4f45406 100644 --- a/libraries/stdlib/src/kotlin/random/Random.kt +++ b/libraries/stdlib/src/kotlin/random/Random.kt @@ -268,7 +268,10 @@ public abstract class Random { /** * Returns a repeatable random number generator seeded with the given [seed] `Int` value. * - * Two generators with the same seed produce the same sequence of values. + * Two generators with the same seed produce the same sequence of values within the same version of Kotlin runtime. + * + * *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. * * @sample samples.random.Randoms.seededRandom */ @@ -278,7 +281,10 @@ public fun Random(seed: Int): Random = XorWowRandom(seed, seed.shr(31)) /** * Returns a repeatable random number generator seeded with the given [seed] `Long` value. * - * Two generators with the same seed produce the same sequence of values. + * Two generators with the same seed produce the same sequence of values within the same version of Kotlin runtime. + * + * *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. * * @sample samples.random.Randoms.seededRandom */