MsgsPerClient divides the number of messages by the number of clients and tries to distribute them as evenly as possible
(numMsgs, numClients int)
| 340 | |
| 341 | // MsgsPerClient divides the number of messages by the number of clients and tries to distribute them as evenly as possible |
| 342 | func MsgsPerClient(numMsgs, numClients int) []int { |
| 343 | var counts []int |
| 344 | if numClients == 0 || numMsgs == 0 { |
| 345 | return counts |
| 346 | } |
| 347 | counts = make([]int, numClients) |
| 348 | mc := numMsgs / numClients |
| 349 | for i := 0; i < numClients; i++ { |
| 350 | counts[i] = mc |
| 351 | } |
| 352 | extra := numMsgs % numClients |
| 353 | for i := 0; i < extra; i++ { |
| 354 | counts[i]++ |
| 355 | } |
| 356 | return counts |
| 357 | } |
no outgoing calls