There was an error while loading. Please reload this page.
2 parents 301ffdb + d2d77c5 commit 5f91423Copy full SHA for 5f91423
core-kotlin/src/test/kotlin/com/baeldung/random/RandomStringUnitTest.kt
@@ -52,7 +52,7 @@ class RandomStringUnitTest {
52
random.nextBytes(bytes)
53
54
var randomString = (0..bytes.size - 1).map { i ->
55
- 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())
56
}.joinToString("")
57
58
assert(randomString.matches(Regex(ALPHANUMERIC_REGEX)))
0 commit comments