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
+18k Golang : How to log each HTTP request to your web server?
+5.2k Golang : Experimental Jawi programming language
+5.9k Golang : Extract unicode string from another unicode string example
+7.9k Javascript : How to check a browser's Do Not Track status?
+19.3k Golang : Calculate entire request body length during run time
+15.8k Golang : Get digits from integer before and after given position example
+11.8k Golang : GTK Input dialog box examples
+15k Golang : Search folders for file recursively with wildcard support
+11.9k Golang : Convert(cast) bigint to string
+10.9k Golang : How to transmit update file to client by HTTP request example
+25.9k Golang : How to read integer value from standard input ?
+11.9k Golang : Determine if time variables have same calendar day