Merge pull request #5711 from nnhai1991/master
BAEL-1913 Generate a random alphanumeric string in Kotlin
This commit is contained in:
commit
5f91423fcb
|
@ -52,7 +52,7 @@ class RandomStringUnitTest {
|
|||
random.nextBytes(bytes)
|
||||
|
||||
var randomString = (0..bytes.size - 1).map { i ->
|
||||
charPool.get((bytes[i] and 0xFF.toByte() and charPool.size.toByte()).toInt())
|
||||
charPool.get((bytes[i] and 0xFF.toByte() and (charPool.size-1).toByte()).toInt())
|
||||
}.joinToString("")
|
||||
|
||||
assert(randomString.matches(Regex(ALPHANUMERIC_REGEX)))
|
||||
|
|
Loading…
Reference in New Issue