diff --git a/README.MD b/README.MD index 6059c1ae8..b215dfb70 100644 --- a/README.MD +++ b/README.MD @@ -66,6 +66,7 @@ func main() { # Contributors +- [aloncn](https://github.com/aloncn) - [chenyang351](https://github.com/chenyang351) - [garfieldkwong](https://gitee.com/garfieldkwong) - [hailaz](https://gitee.com/hailaz) diff --git a/README_ZH.MD b/README_ZH.MD index 998f83995..e29248375 100644 --- a/README_ZH.MD +++ b/README_ZH.MD @@ -86,6 +86,7 @@ func main() { # 贡献者 +- [aloncn](https://github.com/aloncn) - [chenyang351](https://github.com/chenyang351) - [garfieldkwong](https://gitee.com/garfieldkwong) - [hailaz](https://gitee.com/hailaz) diff --git a/g/util/grand/grand_intn.go b/g/util/grand/grand_intn.go index 9677a433e..14dcc032e 100644 --- a/g/util/grand/grand_intn.go +++ b/g/util/grand/grand_intn.go @@ -36,10 +36,15 @@ func init() { i ++ } // 充分利用缓冲区数据,随机索引递增 - step = int(buffer[0])%10 - if step == 0 { - step = 2 + for i := 0; i < n; i++ { + step = int(buffer[0])%10 + if step != 0 { + break + } } + if step == 0 { + step = 2 + } for i := 0; i < n - 4; { bufferChan <- binary.BigEndian.Uint32(buffer[i : i + 4]) i += step