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.12.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

random_permutation-0.1.12-py3-none-any.whl (6.0 kB view hashes)

Uploaded Python 3

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