package main import ( "fmt" "math/rand" ) func main() { r := rand.Int31() fmt.Println(r) }
-354002214
package main import ( "fmt" "math/rand" ) func main() { r := rand.Int31n(100) fmt.Println(r) }
14In the above code examples, we have imported "math/rand" package library and used the Rand Int31 function to generate random numbers. The first example generates an unsigned 31-bit integer while the second example generates a random number between 0 and 100. Thus, the package library used in these examples is "math/rand".