golang生成随机数可以使用math/rand包 package main import ( "fmt" "math/rand" ) func main() { for i:=0; i<10; i++ { fmt.Println(rand.Intn(100)) } }