{"published":"2022-02-12 12:00:36","categories":["go"],"blog_title":"\u96d1\u591a\u306a\u30d6\u30ed\u30b0","image_url":null,"width":"100%","title":"go - \u30e9\u30f3\u30c0\u30e0\u306a\u6570\u5b57\u3092\u751f\u6210\u3059\u308b","author_name":"uc_ebuc","url":"https://cufl.hateblo.jp/entry/2022/02/12/120036","description":"\u7c21\u6613\u7684\u306b\u30e9\u30f3\u30c0\u30e0\u306a\u6570\u5b57\u3092\u751f\u6210\u3059\u308b\u65b9\u6cd5\u3092\u8abf\u3079\u305f\u3002 go\u3067\u30e9\u30f3\u30c0\u30e0\u306a\u6570\u5b57\u3092\u751f\u6210\u3059\u308b\u5834\u5408 math/rand \u304c\u4f7f\u7528\u3067\u304d\u308b\u3002 \u4f7f\u7528\u65b9\u6cd5\u306f\u81f3\u3063\u3066\u30b7\u30f3\u30d7\u30eb\u3002 package main import ( \"time\" \"math/rand\" ) func main() { rand.Seed(time.Now().Unix()) num := rand.Intn(6) println(num) } \u306a\u304a\u3001math/rand \u306f\u7279\u5b9a\u3055\u308c\u308b\u3068\u554f\u984c\u306b\u306a\u308b\u3088\u3046\u306a\u5024\u306e\u751f\u6210\u306b\u306f\u4f7f\u308f\u306a\u3044\u65b9\u304c\u826f\u3044\uff08\u4f8b: \u30e6\u30fc\u30b6\u30fcID\u3084\u30bb\u30c3\u30b7\u30e7\u30f3ID\u306a\u3069\uff09\u3002 \u53b3\u5bc6\u306b\u30e9\u30f3\u30c0\u30e0\u306a\u5024\u3092\u751f\u6210\u3059\u308b\u5834\u5408\u306f\u3001crypt/rand \u3092\u4f7f\u3046\u65b9\u304c\u826f\u3044\u3002 \u4f8b\u3067\u2026","type":"rich","author_url":"https://blog.hatena.ne.jp/uc_ebuc/","blog_url":"https://cufl.hateblo.jp/","height":"190","provider_name":"Hatena Blog","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fcufl.hateblo.jp%2Fentry%2F2022%2F02%2F12%2F120036\" title=\"go - \u30e9\u30f3\u30c0\u30e0\u306a\u6570\u5b57\u3092\u751f\u6210\u3059\u308b - \u96d1\u591a\u306a\u30d6\u30ed\u30b0\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","provider_url":"https://hatena.blog","version":"1.0"}