Edited at

Goで乱数

More than 3 years have passed since last update.


rand.go

package main

import (
"fmt"
"math/rand"
"time"
)

func main() {
rand.Seed(time.Now().UnixNano())
fmt.Println("random number is", rand.Intn(15))
}


$ go run rand.go

5
$ go run rand.go
12
$ go run rand.go
0
$