From ea10215d06c5a00dbd6ed28153e542c1240b165b Mon Sep 17 00:00:00 2001 From: john Date: Mon, 15 Oct 2018 13:13:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9Bgrand=E9=9A=8F=E6=9C=BA?= =?UTF-8?q?=E6=95=B0=E7=94=9F=E6=88=90=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- g/util/grand/grand.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/g/util/grand/grand.go b/g/util/grand/grand.go index 28868e116..549889d0a 100644 --- a/g/util/grand/grand.go +++ b/g/util/grand/grand.go @@ -9,24 +9,14 @@ package grand import ( "time" - "gitee.com/johng/gf/g/util/gconv" ) var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") var digits = []rune("0123456789") -var numChan = make(chan uint, 10000) - -func init() { - go func() { - for { - numChan <- gconv.Uint(time.Now().UnixNano()) - } - }() -} // 自定义的 rand.Intn func intn (max int) int { - return int(<- numChan)%max + return int(time.Now().UnixNano())%max } // 获得一个 min, max 之间的随机数(min <= x <= max)