Commit 1662123a94879525c2bddb5b78f3bcdd9d9258ff

Authored by 陆恒
1 parent d758c67d
Exists in master

提交

Showing 1 changed file with 3 additions and 3 deletions   Show diff stats
src/HttpServer/logic/function.go
... ... @@ -88,7 +88,7 @@ func (u *UserData) DrawTable() int {
88 88 }
89 89 logger.Info("DrawTable sumrate=%v,randnum=%v,cflist=%+v", sumrate, randnum, cflist)
90 90 for _, v := range cflist {
91   - tmprate += int(v.Rate / sumrate)
  91 + tmprate += int(v.Rate * 100 / sumrate)
92 92 logger.Info("DrawTable tmprate=%v", tmprate)
93 93 if tmprate >= randnum {
94 94 idx = v.Id
... ... @@ -109,7 +109,7 @@ func (u *UserData) DrawTable() int {
109 109  
110 110 logger.Info("DrawTable sumrate=%v,randnum=%v,cflist=%+v", sumrate, randnum, cflist)
111 111 for _, v := range cflist {
112   - tmprate += int(v.Rate / sumrate)
  112 + tmprate += int(v.Rate * 100 / sumrate)
113 113 logger.Info("DrawTable tmprate=%v", tmprate)
114 114 if tmprate >= randnum {
115 115 idx = v.Id
... ... @@ -411,7 +411,7 @@ func MergeRedBagCat(uinfo *UserData, pos int) int {
411 411 randnum := rand.Intn(100)
412 412 tmprate := 0
413 413 for _, v := range jsonconf.GetJsonConf().RedCatConfig {
414   - tmprate += int(v.Rate / sumrate)
  414 + tmprate += int(v.Rate * 100 / sumrate)
415 415 if tmprate >= randnum {
416 416 uinfo.PosInfo[pos].Position = pos
417 417 uinfo.PosInfo[pos].Cat = 100 + v.Id
... ...