Skip to content

Commit

Permalink
hotfix: 랜덤 그룹 매칭 알고리즘 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry-Cha committed May 21, 2024
1 parent 74dc008 commit c908b17
Showing 1 changed file with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,9 @@ public List<AutoGroupMatchingResponse> testMethod(
int start = 0;
for (int i = 0; i < groupCount; i++) {
int size = groupSize;
if (i < left) {
if (left >= addCount) {
size += left;
} else {
size += addCount;
left -= addCount;
}
if (left > 0) {
size += Math.min(left, addCount);
left -= addCount;
}
groups.add(members.subList(start, start + size));
start += size;
Expand Down Expand Up @@ -278,13 +274,9 @@ private List<AutoGroupMatchingResponse> getRandomGroup(
int start = 0;
for (int i = 0; i < groupCount; i++) {
int size = groupSize;
if (i < left) {
if (left >= addCount) {
size += left;
} else {
size += addCount;
left -= addCount;
}
if (left > 0) {
size += Math.min(left, addCount);
left -= addCount;
}
groups.add(members.subList(start, start + size));
start += size;
Expand Down

0 comments on commit c908b17

Please sign in to comment.