Skip to main content

A module for efficiently generating very large random permutations

Project description

Random Permutation

This module provides a class RandomPermutation that can be used to generate a random permutation of a given length in O(1) time and space.

Installation

To install the module, run:

pip install random_permutation

Usage

To use the RandomPermutation class, import it from the random_permutation module:

from random_permutation import RandomPermutation

n = 2**20
p = RandomPermutation(n)
for x in p:
  print(x)
# or
for i in range(n):
  print(p[i])

This will output the elements of the RandomPermutation object. You can use the seed parameter to vary the permutations and the num_ciphers parameter to control the number of ciphers used.

Testing

To run the unit tests for the RandomPermutation class, run:

python -m unittest tests.test_permutation

License

This module 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

random_permutation-0.1.15.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

random_permutation-0.1.15-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file random_permutation-0.1.15.tar.gz.

File metadata

  • Download URL: random_permutation-0.1.15.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for random_permutation-0.1.15.tar.gz
Algorithm Hash digest
SHA256 53683fb7ee207e0cf94d302884759ab8f6427b2998c643def004ab4ded6483f0
MD5 db9f941bc50b38ad9a9f0f58f4f9e0d5
BLAKE2b-256 25681148badf6cd0a468c4ba3b113f08761424b2a6468b18e8a9570c34beffa1

See more details on using hashes here.

File details

Details for the file random_permutation-0.1.15-py3-none-any.whl.

File metadata

File hashes

Hashes for random_permutation-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 b7f918b548653eea97b38f014c8bc1cd9072abeb92f0d5ce6fcc559426020960
MD5 083de4d204bc9b574eebb681de550aa6
BLAKE2b-256 2b2cd67b326e21f8b6f7b1de61c04114e19b7614a295a5def57480a7c558ea03

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