Golang math/rand.Intn() function example
package math/rand
Golang math/rand.Intn() function usage example
package main
import (
"fmt"
"math/rand"
)
func main() {
n := 10
i := 0
for i < n {
x := rand.Intn(10)
fmt.Println(i, x)
i += 1
}
fmt.Println("i : ", i)
}
Reference :
Advertisement
Something interesting
Tutorials
+17.4k Golang : Check if IP address is version 4 or 6
+12.4k Elastic Search : Return all records (higher than default 10)
+27.4k Golang : Convert CSV data to JSON format and save to file
+6.1k Fix ERROR 2003 (HY000): Can't connect to MySQL server on 'IP address' (111)
+7.5k Golang : Process json data with Jason package
+27.6k Golang : dial tcp: too many colons in address
+12.3k Golang : List running EC2 instances and descriptions
+8.6k Android Studio : Import third-party library or package into Gradle Scripts
+23.9k Golang : Use regular expression to validate domain name
+7k Golang : constant 20013 overflows byte error message
+30k Golang : How to declare kilobyte, megabyte, gigabyte, terabyte and so on?
+6.1k Golang : Grab news article text and use NLP to get each paragraph's sentences