Skip to content

Commit

Permalink
Add randomness to matcher assignment generation
Browse files Browse the repository at this point in the history
  • Loading branch information
smartspot2 committed Aug 13, 2024
1 parent 1c253e9 commit 9dd5d6a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions csm_web/scheduler/views/matcher.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
import random

from django.db import transaction
from django.db.models import Q
Expand Down Expand Up @@ -560,6 +561,13 @@ def run_matcher(course: Course):
)
)

# randomize lists, seeded with the course id;
# this ensures that tiebreaks are approximately uniform
random.seed(course.id)
random.shuffle(mentor_list)
random.shuffle(slot_list)
random.shuffle(preference_list)

# run the matcher
return get_matches(mentor_list, slot_list, preference_list)

Expand Down

0 comments on commit 9dd5d6a

Please sign in to comment.