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
+32.2k Golang : Convert []string to []byte examples
+17k Golang : Covert map/slice/array to JSON or XML format
+4.7k Chrome : How to block socketloop.com links in Google SERP?
+9.2k nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
+9.5k Mac OSX : Get a process/daemon status information
+7.2k Golang : Check if one string(rune) is permutation of another string(rune)
+4.7k Javascript : Access JSON data example
+14.6k Golang : Execute function at intervals or after some delay
+9.6k Golang : Copy map(hash table) example
+26k Golang : Convert IP address string to long ( unsigned 32-bit integer )
+15.7k Golang : Get checkbox or extract multipart form data value example
+7.7k Gogland : Where to put source code files in package directory for rookie