fix java code
This commit is contained in:
parent
3221968f9e
commit
a15a0809ec
|
@ -1,5 +1,6 @@
|
||||||
import org.apache.commons.lang3.RandomStringUtils
|
import org.apache.commons.lang3.RandomStringUtils
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
import java.util.concurrent.ThreadLocalRandom
|
||||||
import kotlin.streams.asSequence
|
import kotlin.streams.asSequence
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
|
@ -15,7 +16,8 @@ class RandomStringTest {
|
||||||
charPool.addAll('A'..'Z');
|
charPool.addAll('A'..'Z');
|
||||||
charPool.addAll('0'..'9');
|
charPool.addAll('0'..'9');
|
||||||
|
|
||||||
var randomString = java.util.Random().ints(STRING_LENGTH.toLong(), 0, charPool.size)
|
var randomString = ThreadLocalRandom.current()
|
||||||
|
.ints(STRING_LENGTH.toLong(), 0, charPool.size)
|
||||||
.asSequence()
|
.asSequence()
|
||||||
.map(charPool::get)
|
.map(charPool::get)
|
||||||
.joinToString("")
|
.joinToString("")
|
||||||
|
|
Loading…
Reference in New Issue