What's the purpose of the random number code in a real-life program? given below is a go program
package main
import(
"fmt"
"math/rand"
"time"
)
func random(min, max int) int {
rand.Seed(time.Now().Unix())
return rand.Intn(max - min) + min
}
func main() {
myrand := random(1, 6)
fmt.Println(myrand)
}
Aucun commentaire:
Enregistrer un commentaire