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.12.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0733657a9c37621963456e6e3917bf974332cf6f72157e019e3b69f587fe547b |
|
MD5 | 4c344b342b81eecd0d0616b5ce328e8b |
|
BLAKE2b-256 | 4c847bc1cf7b644bbb13626f9db78830d1b775b7b07467b75462f22f772a5125 |
Close
Hashes for random_permutation-0.1.12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5427892a11915615d1de7f07fafbb62e5fde7d7da21f82fefeedc7273c8fb0c5 |
|
MD5 | a9a9e35ed10411938a685891abc0eda1 |
|
BLAKE2b-256 | adea0c89b4cf3588236899e8348f67b2af271141d7aee639cba002e67392bdbc |