标签:page rand edr 需要 ack i++ done rgb sync
package main import ( "fmt" "math/rand" "sync" "time" ) var wg sync.WaitGroup func f1(i int) { wg.Done() fmt.Println(i) } func main() { rand.Seed(time.Now().UnixNano())//让每次的随机数都不一样,需要添加时间戳种子 for i := 0; i < 10; i++ { r := rand.Intn(100) wg.Add(1) go f1(r) } wg.Wait() fmt.Println("main") }
参考:https://www.bilibili.com/video/BV1fz4y1m7Pm?p=95&spm_id_from=pageDriver
标签:page rand edr 需要 ack i++ done rgb sync
原文地址:https://www.cnblogs.com/dzw159/p/14940624.html