I have a loop that needs to wait a random amount of time before looping again.
What I have:
for {
rand.Seed(time.Now().UnixNano())
r := rand.Int()
//Do stuff
t, _ := time.ParseDuration(string(r) + "ms")
time.Sleep(t)
}
Unfortunately, the loops run multiple times, just like if time.Sleep
was not working.