1
0
mirror of https://github.com/mamoe/mirai.git synced 2025-04-14 23:20:49 +08:00

[core] Optimize array expansions

This commit is contained in:
Him188 2022-11-02 19:28:28 +00:00
parent 7cbff5a8c2
commit f24ca9628f
No known key found for this signature in database
GPG Key ID: BA439CDDCF652375
2 changed files with 2 additions and 2 deletions
mirai-core-utils/src/commonMain/kotlin
mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image

View File

@ -55,4 +55,4 @@ public fun getRandomString(length: Int, vararg charRanges: CharRange, random: Ra
public fun getRandomIntString(length: Int, random: Random = Random): String =
getRandomString(length, *intCharRanges, random = random)
getRandomString(length, charRanges = intCharRanges, random = random)

View File

@ -22,7 +22,7 @@ import kotlin.random.Random
import kotlin.random.nextInt
internal fun getRandomString(length: Int): String =
getRandomString(length, *defaultRanges)
getRandomString(length, charRanges = defaultRanges)
private val defaultRanges: Array<CharRange> = arrayOf('a'..'z', 'A'..'Z', '0'..'9')