Go语言 随机数种子 package main import ( "time" "math/rand" ) func main() { t1 := time.Now().UnixNano() //取到当前时间,精确到纳秒 rand.Seed(t1) //把当前时间作为种子 }