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
+11.3k Golang : How to flush a channel before the end of program?
+12.3k Golang : How to display image file or expose CSS, JS files from localhost?
+10k Golang : Setting variable value with ldflags
+6.7k Golang : Reverse by word
+11k Golang : Create Temporary File
+7.4k Linux : How to fix Brother HL-1110 printing blank page problem
+29.9k Golang : How to get HTTP request header information?
+5.8k Unix/Linux : Get reboot history or check when was the last reboot date
+10.2k Golang : Random Rune generator
+9.4k Golang : Find the length of big.Int variable example
+4.7k Javascript : Access JSON data example