kotlin 生成随机数


fun main(args: Array<String>) {

 	val list = listOf(3, 1, "a", "x",5,9,"t",2,7)
    val n = 5
	var anyStr = ""
     
      for (i in 1..n) {
           anyStr += list.random().toString()
      }
      
  println(anyStr)

}

你可能感兴趣的:(kotlin)