diff options
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/util/Random.scala | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/library/scala/util/Random.scala b/src/library/scala/util/Random.scala index 8d68c5be38..2d38c9d4a0 100644 --- a/src/library/scala/util/Random.scala +++ b/src/library/scala/util/Random.scala @@ -121,15 +121,21 @@ class Random(val self: java.util.Random) extends AnyRef with Serializable { (bf(xs) ++= buf).result() } + @deprecated("Preserved for backwards binary compatibility. To remove in 2.12.x.", "2.11.6") + final def `scala$util$Random$$isAlphaNum$1`(c: Char) = (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') + /** Returns a Stream of pseudorandomly chosen alphanumeric characters, * equally chosen from A-Z, a-z, and 0-9. * * @since 2.8 */ def alphanumeric: Stream[Char] = { - def isAlphaNum(c: Char) = (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') + def nextAlphaNum: Char = { + val chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" + chars charAt (self nextInt chars.length) + } - Stream continually nextPrintableChar filter isAlphaNum + Stream continually nextAlphaNum } } |