I want generator ip in for loop golang, but it is duplicated because the initialization timeline is too fast. I've been seed time but this is not enough for it to work, any code to help me? Thank you!!
for i := 100000; i<999999; i++ {
wg.Add(1)
rand.Seed(time.Now().UTC().UnixNano())
ip := strconv.Itoa(rand.Intn(999 - 0) + 0)+"."+strconv.Itoa(rand.Intn(99 - 0) + 0)+"."+strconv.Itoa(rand.Intn(999 - 0) + 0)+"."+strconv.Itoa(rand.Intn(999 - 0) + 0)
fmt.Println(ip)
go _run_(ip)
}
Aucun commentaire:
Enregistrer un commentaire