golang rand 随机例子

package main

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

func main() {
    rand.Seed(time.Now().UnixNano())
    for i := 0; i < 10; i++ {
        x := rand.Intn(100)
        fmt.Println(x)
    }
}
--------------------- 
作者:Yatere 
来源:CSDN 
原文:https://blog.csdn.net/yatere/article/details/8765540 
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自blog.csdn.net/jfkidear/article/details/85197386
今日推荐