I read the documentation for the function Intn https://golang.org/pkg/math/rand/#Intn but I don't understand what they mean I know how random differs from pseudo-random. But how can I simulate a random in the range from 1 to 1000 for example?
package main
import (
"fmt"
"math/rand"
)
func main() {
fmt.Println(randInt(1, 1000))
}
func randInt(min int, max int) int {
return min + rand.Intn(max-min)
}
The answer is always 879
func main() {
fmt.Print(rand.Intn(100))
}
The answer is always 81