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
+5.4k Python : Delay with time.sleep() function example
+7.2k Golang : Dealing with postal or zip code example
+11.3k Golang : Byte format example
+7.5k Golang : Create zip/ePub file without compression(use Store algorithm)
+10.6k Golang : How to delete element(data) from map ?
+21.1k Golang : For loop continue,break and range
+10.3k Golang : Detect number of faces or vehicles in a photo
+9.2k Golang : Generate Codabar
+36k Golang : Get file last modified date and time
+10.2k Golang : Text file editor (accept input from screen and save to file)
+6.4k Golang : How to search a list of records or data structures
+17k Golang : Covert map/slice/array to JSON or XML format