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
+19.2k Golang : Execute shell command
+30.8k Golang : Download file example
+23.6k Golang : minus time with Time.Add() or Time.AddDate() functions to calculate past date
+6.1k Golang : How to write backslash in string?
+5k Golang : Get a list of crosses(instruments) available to trade from Oanda account
+9.9k Golang : Ordinal and Ordinalize a given number to the English ordinal numeral
+9.7k Golang : Load ASN1 encoded DSA public key PEM file example
+10.3k Golang : Detect number of faces or vehicles in a photo
+6.2k Linux/Unix : Commands that you need to be careful about
+17.9k Golang : Login and logout a user after password verification and redirect example
+4.7k MariaDB/MySQL : Form select statement or search query with Chinese characters
+21.3k Golang : Create and resolve(read) symbolic links