Merge pull request #10267 from eugenp/KTLN-173

simplify random string generation
This commit is contained in:
Loredana Crusoveanu 2020-11-23 15:15:40 +02:00 committed by GitHub
commit 745ec2b2cf
1 changed files with 1 additions and 1 deletions

View File

@ -54,7 +54,7 @@ class RandomStringUnitTest {
random.nextBytes(bytes) random.nextBytes(bytes)
var randomString = (0..bytes.size - 1).map { i -> var randomString = (0..bytes.size - 1).map { i ->
charPool.get((bytes[i] and 0xFF.toByte() and (charPool.size-1).toByte()).toInt()) charPool[random.nextInt(charPool.size)]
}.joinToString("") }.joinToString("")
assert(randomString.matches(Regex(ALPHANUMERIC_REGEX))) assert(randomString.matches(Regex(ALPHANUMERIC_REGEX)))