Skip to main content

Complete shuffling of lists with true random or pseudo random sequences.

Project description

complete_shuffle

PyPI PyPI - Status GitHub Release Date Language grade: Python Codacy Badge PyPI - Downloads PyPI - Python Version PyPI - License

Complete shuffling of lists with true random or pseudo random sequences.

Multiple external true random sources can be accessed to shuffle the list.

In addition to the shuffle function, there are also random cyclic permutation functions, and the derangement function.

Installation

Installation can be done through pip. You must have python version >= 3.8

pip install complete-shuffle

Usage

The statement to import the package:

from complete_shuffle_package import *

Example:

>>> from gmpy2 import bit_mask as gmpy2_bit_mask
>>> prng_period = calculate_number_of_shuffles_required(12, 'prng_period')
>>> seed = 170141183460469231731687303715884105727 & gmpy2_bit_mask((prng_period - 1).bit_length())
#The entropy of the seed must not be less than the number of permutations in the list.(Calculate with "calculate_number_of_shuffles_required" function)

>>> sequence_list = list(range(12))
>>> pr_complete_shuffle(sequence_list, seed)
>>> sequence_list
[6, 0, 9, 11, 2, 1, 7, 5, 3, 10, 4, 8]

>>> sequence_list = list(range(12))
>>> pr_complete_cyclic_permutation(sequence_list, seed)
>>> sequence_list
[6, 11, 0, 9, 2, 1, 7, 5, 3, 10, 4, 8]

>>> sequence_list = list(range(12))
>>> pr_complete_derangement(sequence_list, seed)
>>> sequence_list
[6, 0, 9, 11, 2, 1, 7, 5, 3, 10, 4, 8]

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

complete_shuffle-1.1.2.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

complete_shuffle-1.1.2-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file complete_shuffle-1.1.2.tar.gz.

File metadata

  • Download URL: complete_shuffle-1.1.2.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

File hashes

Hashes for complete_shuffle-1.1.2.tar.gz
Algorithm Hash digest
SHA256 7482083a91b5fd8d1d3f6b1583b5491ef6e1e60f00b3c982ed7650ad134b7ba3
MD5 06e6bc3e534f7161a9f43f6881199089
BLAKE2b-256 5ccabc917a4a3c986104e2f46b7afb189d9b71912af5ce52a92a5b17b1b04dad

See more details on using hashes here.

File details

Details for the file complete_shuffle-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: complete_shuffle-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

File hashes

Hashes for complete_shuffle-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eb9e64a8aa27052fd2461888d46a90af00e88827d1e04f053456cf7a094b08a4
MD5 b6c456f3b34b9e4b1f1e80925a07c769
BLAKE2b-256 1733615a3112712526bf3269d362873a82bd8cc28f37919c02e9fc1bfa2f2978

See more details on using hashes here.

Supported by

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