package main
import (
"fmt"
"flag"
"math/rand"
)
func main() {
// Define flags
max := flag.Int("max", 6, "the max value")
// Parse
flag.Parse()
// Generate a number between 0 and max
fmt.Println(rand.Intn(*max))
}
网友评论