Golang math/rand.Int31() function example
package math/rand
Golang math/rand.Int31() function usage example
package main
import (
"fmt"
"math/rand"
)
func main() {
n := 10
i := 0
var x int32
for i < n {
x = rand.Int31()
i += 1
}
fmt.Println("x : ", x)
fmt.Println("i : ", i)
}
Reference :
Advertisement
Something interesting
Tutorials
+11.5k Golang : Format numbers to nearest thousands such as kilos millions billions and trillions
+8.3k Golang : Configure Apache and NGINX to access your Go service example
+10.6k Golang : ISO8601 Duration Parser example
+11.5k CodeIgniter : Import Linkedin data
+9.7k Golang : Eroding and dilating image with OpenCV example
+6.5k Golang : Map within a map example
+13.2k Golang : Skip blank/empty lines in CSV file and trim whitespaces example
+9.2k Golang : Generate Codabar
+5.5k Golang : Display advertisement images or strings on random order
+7.9k Golang : Ways to recover memory during run time.