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.0.tar.gz (2.6 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.0-py3-none-any.whl (2.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: shufflemates-0.1.0.tar.gz
  • Upload date:
  • Size: 2.6 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.0.tar.gz
Algorithm Hash digest
SHA256 fc7425d715f141198aa6c343641f4a95a59a72cec918a92bcc0a4e35cc65b902
MD5 9b4a50d0be9df5e2f499ee0344db0668
BLAKE2b-256 d7e8c6efe35e054e3ad7c03ab377065ae831cd14dfd491f70b872f3d2721550c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: shufflemates-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dec9a9ec23037785ad377172647835b4a02a9654ceea5831586482c54782fe34
MD5 b78b6c4f8959973fececef2f3a21c226
BLAKE2b-256 f04c7279eb9fb728064897ef168145884c19b9df04219939e5ff06faf09760ab

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