Go Cheatsheet - Random
Random
Pseudo Random Function
Use math/rand
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
num := rand.Int()
fmt.Println("Random Integer:", num)
// generate a number [0, 100)
num = rand.Intn(100)
fmt...
hn.0xbf.me1 min read