Skip to main content

A Python package for randomly grouping students or teams.

Project description

Shufflemates 🎲✨

A simple Python package for randomly grouping members while supporting fixed pairs and locked teams.

Shufflemates is a Python package that helps you shuffle a list of members into balanced groups while ensuring that some members stay together (fixed pairs) and others remain in exclusive groups (locked teams).

🚀 Installation

You can install Shufflemates via pip:

pip install shufflemates

🎯 Features

  • Randomly shuffle members into groups of a specified size.
  • Ensure fixed pairs or teams are always grouped together.
  • Lock specific groups so that no extra members are added.
  • Ensure balanced team sizes even when the total number of members is not a perfect multiple of the group size.

🛠️ Usage

Here's a quick example of how to use Shufflemates:

from shufflemates import shuffle_groups
members = list(range(17))  # Members 0 to 16

group_size = 3
fixed_pairs = [(3, 4), (7, 8, 9)]
locked_teams = [(11, 12, 13)]

# case 1
groups = shuffle_groups(members, group_size, fixed_pairs=fixed_pairs, locked_teams=locked_teams)

for idx, group in enumerate(groups, 1):
    print(f"Group {idx}: {group}")

# or 
# case 2
print_shuffle_groups(
    members,
    group_size,
    fixed_pairs=fixed_pairs,
    locked_teams=locked_teams,
    num_iterations=12,
    iterations_time=0.5)

✅ Example Output

Group 1: [3, 4, 1]
Group 2: [7, 8, 9]
Group 3: [11, 12, 13]  <-- Locked team (No extra members)
Group 4: [2, 10, 14]
Group 5: [15, 0, 6]
Group 6: [5, 16]

📜 License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shufflemates-0.1.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shufflemates-0.1.2-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file shufflemates-0.1.2.tar.gz.

File metadata

  • Download URL: shufflemates-0.1.2.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for shufflemates-0.1.2.tar.gz
Algorithm Hash digest
SHA256 049255e4e6d7cf38b6b93802e4fc5d010adebc7b2e84b064da4007bc2e922a87
MD5 f8f2d8504f50702f2212a3863b3ba70a
BLAKE2b-256 a1d202d06e251ef4960194d808943623c8cf0d00fbf5b5995c780d11ed538ed8

See more details on using hashes here.

File details

Details for the file shufflemates-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: shufflemates-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for shufflemates-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e04912da05ebe70cd80635c6c1c9d43b530d2ba2caa8d7458f716aefb846d39d
MD5 99141a6e1a6b43551ad6f5b1c1011a24
BLAKE2b-256 69de35a1491a20345a64d58fdcb7a59e1aa9bd842de6cf8daaad022f78eb0f5d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page