fix possible index out of bound
@@ -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)))
