Golang math/rand.Int31n() function example
package math/rand
Golang math/rand.Int31n() function usage example
package main
import (
"fmt"
"math/rand"
)
func main() {
n := 10
i := 0
var x int32
for i < n {
x = rand.Int31n(10)
fmt.Println("x : ", x)
i += 1
}
fmt.Println("i : ", i)
}
Reference :
Advertisement
Something interesting
Tutorials
+15.2k Golang : Accurate and reliable decimal calculations
+15.9k Golang : Get file permission
+9.5k Golang : Detect Pascal, Kebab, Screaming Snake and Camel cases
+23.5k Golang : Get ASCII code from a key press(cross-platform) example
+6k Javascript : Get operating system and browser information
+5k Golang : Get a list of crosses(instruments) available to trade from Oanda account
+5.9k Golang : Denco multiplexer example
+14.3k Golang : Get uploaded file name or access uploaded files
+5.9k AWS S3 : Prevent Hotlinking policy
+21.1k Golang : For loop continue,break and range
+7.4k Golang : Word limiter example
+13.2k Golang : Skip blank/empty lines in CSV file and trim whitespaces example