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_group(
    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.1.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.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: shufflemates-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 ad8be03d84aab453afb0e0dbc21e26333eee963e1f541a15f3ca0c7364d0de42
MD5 9680170b50469f1c5ee1c5229fa71a40
BLAKE2b-256 2c5e992fbc5dc64ba8fb2f3a4bd0dea0943e46c5c43a4a8da00fd5f9e065542c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: shufflemates-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 62372fe043e249971df00eae6b3b5bed2936a063de2c501a8dc56e84e9f96524
MD5 860f53640029b8d03730c5299281c83f
BLAKE2b-256 02e10b9d43cf15cd359bc6001b5a0841fce2e92c3c03497f1c2a27a568619235

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