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
+9.2k Golang : does not implement flag.Value (missing Set method)
+6.9k Golang : Pat multiplexer routing example
+6.4k Golang : How to search a list of records or data structures
+14.5k Golang : Overwrite previous output with count down timer
+13.3k CodeIgniter : "Fatal error: Cannot use object of type stdClass as array" message
+12.7k Android Studio : Highlight ImageButton when pressed on example
+5.6k Golang : Shortening import identifier
+4.9k Unix/Linux : secure copying between servers with SCP command examples
+14k Golang : Fix cannot use buffer (type bytes.Buffer) as type io.Writer(Write method has pointer receiver) error
+25.4k Golang : Convert long hexadecimal with strconv.ParseUint example
+5.3k Swift : Convert string array to array example
+5.4k Golang : fmt.Println prints out empty data from struct