Skip to main content

A package for unique random selection

Project description

Unique Picker

Unique Picker is a Python package that allows you to randomly select an item from a list without repeating any item until all items in the list are covered. Once all items are selected, the list is reshuffled, and the process continues.

Installation

You can install the package using pip:

pip install unique-picker

Usage

Import the Package

import uniquePicker

How to Use

Use the choice function to randomly select an item from a list:

data_list = [1, 2, 3, 4, 5]
for _ in range(10):
    print(uniquePicker.choice(data_list))

Output

The choice function ensures that:

  • No item is repeated until all items in the list are selected.
  • After all items are used, the list is reshuffled for the next cycle.

Example Output:

css


3
5
1
4
2
(all items reshuffled)
4
3
2
5
1

Features

  • Random selection without immediate repetition.
  • Automatic reshuffling after all items are covered.
  • Easy-to-use API, just like Python’s random.choice.

Code Example

Here’s a complete working example:

import uniquePicker

# Define your list
data_list = ['apple', 'banana', 'cherry', 'date', 'elderberry']

# Select items
print("Random selections without repeats:")
for _ in range(10):
    print(uniquePicker.choice(data_list))

How It Works

  • The unique_picker.choice function internally uses a class to manage the list and its current state.
  • It shuffles the list when all items are exhausted, ensuring fair and unique selection in cycles.

License

This package is distributed under the MIT License. See the LICENSE file for details.

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

unique-picker-0.0.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

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

unique_picker-0.0.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file unique-picker-0.0.1.tar.gz.

File metadata

  • Download URL: unique-picker-0.0.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for unique-picker-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f6a0ade228c9b5f0f2ef19449ad7934423e1c321ffa88f84ee8941dd2b9e81e6
MD5 1cd0c538e5f59f587488977eda36a7d6
BLAKE2b-256 88d9954f43884a20145e9c0c21400619904b89c49172065174b3b46e11324331

See more details on using hashes here.

File details

Details for the file unique_picker-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: unique_picker-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for unique_picker-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7f76aa891456265f644f6ee9a9dbced819c114e686284b78787027b35fd91da6
MD5 f224837c6e145c12c28e4cb60ae19319
BLAKE2b-256 759ece435dced035c88c13a0369f530dcc29682cde623da8497a61d49b7a0774

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