dimanche 30 août 2020

Random integer in goalng are predictable in each runtime

I'm using math/rand package to generate random integer number as temporary tokens. The problem is the random numbers are predictable (same sequence always) in each runtime. I've even used Seed() function before calling rand.Intn(100000) but those numbers are also predictable. Is there a way to generate truly random numbers in Golang? By the way here is my final code.

rand.Seed(rand.Intn(500))
fmt.Println(rand.Intn(100000))



Aucun commentaire:

Enregistrer un commentaire