Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
fcd9650701 |
1 changed files with 4 additions and 14 deletions
|
|
@ -15,20 +15,10 @@ class Group(BaseModel):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def pair(names: list[str]) -> dict[str, str]:
|
def pair(names: list[str]) -> dict[str, str]:
|
||||||
names_copy = names[:]
|
random.shuffle(names)
|
||||||
random.shuffle(names_copy)
|
names_copy = names[1:]
|
||||||
|
names_copy.append(names[0])
|
||||||
pairings = {}
|
return dict(zip(names, names_copy))
|
||||||
for i, name in enumerate(names):
|
|
||||||
pair = names_copy[i]
|
|
||||||
while pair == name:
|
|
||||||
random.shuffle(names_copy)
|
|
||||||
pair = names_copy[i]
|
|
||||||
|
|
||||||
pairings[name] = pair
|
|
||||||
|
|
||||||
return pairings
|
|
||||||
|
|
||||||
|
|
||||||
class IRepo(ABC):
|
class IRepo(ABC):
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue