Golang random number generator needs a seed in order to really generate a random number. Without seed, if you ran the randomizer 10 times now and 10 times a minute later, you will notice that the numbers produced are the same.
package mainimport (
"fmt"
"time"
"math/rand"
)func main() {
for z:=0; z<9; z++ {
rand.Seed(time.Now().UTC().UnixNano())
fmt.Println("My favorite number is", rand.Intn(10))
}
}