improve grand.Intn; README updates

This commit is contained in:
John
2019-04-10 23:09:38 +08:00
parent acac5a2ad6
commit c7a6a6fff0
3 changed files with 10 additions and 3 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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