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
+31.5k Golang : Example for ECDSA(Elliptic Curve Digital Signature Algorithm) package functions
+7.5k Golang : Dealing with struct's private part
+19k Golang : Padding data for encryption and un-padding data for decryption
+36.5k Golang : Save image to PNG, JPEG or GIF format.
+16.9k Golang : Get the IPv4 and IPv6 addresses for a specific network interface
+10.1k Golang : Check a web page existence with HEAD request example
+16.4k Golang : Send email and SMTP configuration example
+16.6k Golang : Generate QR codes for Google Authenticator App and fix "Cannot interpret QR code" error
+17.3k Golang : How to tell if a file is compressed either gzip or zip ?
+7.9k Javascript : How to check a browser's Do Not Track status?
+8.1k Golang : Tell color name with OpenCV example
+21.1k Golang : Convert(cast) string to rune and back to string example