请问arr里面有张三吗?
```
package main
import (
"fmt"
"math/rand"
"time"
)
type SonSeed struct {
RtaObject string
}
type FatherSeedStu struct {
name string
age int
Son *SonSeed
}
func init() {
rand.Seed(time.Now().UnixNano())
}
func Seed1() {
var st *FatherSeedStu
st = new(FatherSeedStu)
st.Son = new(SonSeed)
arr := make([]*FatherSeedStu, 0)
for i := 0; i < 3; i++ {
rdn := rand.Intn(5)
if rdn < 2 {
st.Son.RtaObject = "张三"
} else {
st.Son.RtaObject = "李四"
}
temp := *st
if temp.Son.RtaObject == "李四" {
arr = append(arr, &temp)
}
}
for k := range arr {
fmt.Println("---写入:", arr[k].Son.RtaObject)
}
}
func main() {
for i := 0; i < 20; i++ {
go func() {
Seed1()
}()
}
time.Sleep(1 * time.Second)
}
```
有疑问加站长微信联系(非本文作者)