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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for random_permutation-0.1.14.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18daedba5c602e65f623a1fb6e826854e76e7c22e58992369fdec64ef99eacf7 |
|
MD5 | 783e0a970e5de9b45a02b7021dbe8785 |
|
BLAKE2b-256 | 8e1b1b49ee1a3151f6a8759d9cad48265398c90a7f928641d07370505638dbfa |
Close
Hashes for random_permutation-0.1.14-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d800b40b3bb1ff7bcd50d40a50551b7c40e3d9f4bb6640d539fa541173d8d97 |
|
MD5 | 54ed93d30c3592487ce3b250319b7be5 |
|
BLAKE2b-256 | 7c3046431e4e35069c13f6c0a7eadf7f351cdc82667965d731f4ad6d03aca103 |