I am very new and interested person in Golang. I have completed only basics arithmetic in Golang.
Now I am trying to generate random number in Go But it always returns the same number.
I have imported math/rand
.
And my code to write a random number is:
fmt.Print(rand.Int())
It always returns 134020434
And I have also tried
fmt.Print(rand.Intn(100))
It always returns the number 81
Even I tried the online playground of Go.
The result is same.
Can anyone explain, what's happening here ?
Aucun commentaire:
Enregistrer un commentaire