Golang math/rand.Int() function example
package math/rand
Golang math/rand.Int() function usage example
package main
import (
"fmt"
"math/rand"
)
func main() {
n := 10
i := 0
var x int
for i < n {
x = rand.Int()
i += 1
}
fmt.Println("x : ", x)
fmt.Println("i : ", i)
}
Reference :
Advertisement
Something interesting
Tutorials
+15.2k Golang : How to check if IP address is in range
+15.2k JavaScript/JQuery : Detect or intercept enter key pressed example
+6.8k Golang : Muxing with Martini example
+5k Golang : micron to centimeter example
+15.8k Golang : Get digits from integer before and after given position example
+41.4k Golang : Convert string to array/slice
+6.2k Golang : Extract XML attribute data with attr field tag example
+6.1k Golang : How to write backslash in string?
+13.6k Android Studio : Password input and reveal password example
+9.1k Golang : io.Reader causing panic: runtime error: invalid memory address or nil pointer dereference
+5.4k Golang *File points to a file or directory ?
+17.5k Golang : Find smallest number in array