fun main() {
val dictChars = mutableListOf<Char>().apply { "123456789zxcvbnmasdfghjklqwertyuiop".forEach { this.add(it) } }
val randomStr = StringBuilder().apply { (1..((10..30).random())).onEach { append(dictChars.random()) } }
println(randomStr.toString())
}
Kotlin 随机长度随机字母数字字符串
最新推荐文章于 2024-07-16 10:42:18 发布