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
+8.8k Golang : Take screen shot of browser with JQuery example
+21.2k Golang : Convert(cast) string to rune and back to string example
+23k Golang : Calculate time different
+11.3k Golang : Post data with url.Values{}
+8.1k Golang : Multiplexer with net/http and map
+9k Golang : Inject/embed Javascript before sending out to browser example
+9.2k Golang : How to check if a string with spaces in between is numeric?
+6.4k Golang : Break string into a slice of characters example
+33.7k Golang : All update packages with go get command
+7.9k Golang : Get today's weekday name and calculate target day distance example
+10k Golang : Get escape characters \u form from unicode characters
+9k Golang : automatically figure out array length(size) with three dots