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.
This commit is contained in:
Ilya Gorbunov
2018-09-25 06:07:38 +03:00
parent 896913907b
commit bb9e9ac1ee
+8 -2
View File
@@ -268,7 +268,10 @@ public abstract class Random {
/** /**
* Returns a repeatable random number generator seeded with the given [seed] `Int` value. * 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 * @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. * 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 * @sample samples.random.Randoms.seededRandom
*/ */