Golang math/rand.Perm() function example
package math/rand
Golang math/rand.Perm() function usage example
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
n := 10
i := 0
r := rand.New(rand.NewSource(time.Now().UnixNano()))
for i < n {
x := r.Perm(10)
fmt.Println(x)
i += 1
}
}
Reference :
Advertisement
Something interesting
Tutorials
+13.2k CodeIgniter : "Fatal error: Cannot use object of type stdClass as array" message
+5.7k List of Golang XML tutorials
+31.5k Golang : Example for ECDSA(Elliptic Curve Digital Signature Algorithm) package functions
+4.4k Golang : Valued expressions and functions example
+30.5k Get client IP Address in Go
+10.9k Golang : Get UDP client IP address and differentiate clients by port number
+36.5k Golang : Validate IP address
+7.1k Golang : Validate credit card example
+19.5k Golang : How to Set or Add Header http.ResponseWriter?
+9.3k Golang : Timeout example
+4.7k Chrome : How to block socketloop.com links in Google SERP?
+8.8k Golang : Get final balance from bit coin address example