// https://golang.org/pkg/math/rand/
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
cards := []string{"A", "B", "C"}
rand.Seed(time.Now().UnixNano())
for i := 0; i < 10; i++ {
num := rand.Intn(len(cards))
fmt.Println(cards[num])
}
}
// result
// e.g
// C
// C
// C
// C
// C
// B
// B
// C
// B
// C
Original by Github issue
チャットメンバー募集
何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。