A comprehensive stress testing data generator for competitive programming with cryptographically secure randomness
Project description
cpstress
A comprehensive stress testing data generator for competitive programming with cryptographically secure randomness.
Version History
v0.2.0 - Bug Fixes & Improvements
- ✅ Fixed edge cases in graph generation (weighted graph parameter handling)
- ✅ Improved performance for large-scale random generation
- ✅ Enhanced documentation and examples
- ✅ Fixed import paths and module organization
- ✅ Added better error handling for invalid parameters
- ✅ Optimized random number generation for cryptographic security
v0.1.0 - Initial Release
- Initial stable release with core functionality
Features
- Arrays: Random arrays, permutations, matrices, pairs, subsets, partitions, and specialized patterns (strictly increasing/decreasing, arithmetic/geometric progressions)
- Numbers: Random integers, floats, weighted random selection, exclusion sets
- Strings: Random strings with case control, palindromes, alphanumeric strings, custom alphabets
- Graphs: Trees, simple graphs, weighted graphs, directed graphs, DAGs, bipartite graphs, cycles, complete graphs, regular graphs
- Secure Randomness: Uses
secrets.SystemRandom()instead of Python's predictable MT19937 algorithm
Installation
From PyPI
pip install cpstress
From Source
git clone https://github.com/sharpsalt/cpstress.git
cd cpstress
pip install -e .
Quick Start
from cpstress.generators import gen_arrays, gen_numbers, gen_strings, gen_graphs
# Generate random array
arr = gen_arrays.random(10, 1, 100)
print(arr)
# Generate random integer
num = gen_numbers.random_int(1, 1000)
print(num)
# Generate random string
s = gen_strings.random(15, CaseType.Mixed)
print(s)
# Generate tree
tree = gen_graphs.tree(10)
print(tree)
Module Reference
Arrays (gen_arrays)
random(len, l, r, unique=False, sorted=False)- Random arraypermutation(n)- Random permutationmatrix(rows, cols, l, r)- Random matrixpairs(len, l1, r1, l2, r2, ordered=False)- Random pairssubset(l, r, k, sorted=False)- Random subsetpartition(sum, k, min_val, max_val)- Partition sum into k partsstrictly_increasing/decreasing()- Monotonic sequencesarithmetic_progression/geometric_progression()- Special sequencesbit_array(len, prob_one=0.5)- Binary array
Numbers (gen_numbers)
random_int(l, r)- Random integerrandom_real(l, r)- Random floatrandom_range(l, r, count)- List of random numbersrandom_exclude(l, r, exclude_set)- Random excluding valuesrandom_weighted(values, weights)- Weighted random selectionrandom_real_exclude()- Random float with exclusion range
Strings (gen_strings)
random(len, case_type)- Random stringpalindrome(len, case_type)- Random palindromerandom_alphanum(len, letters, digits, case_type)- Alphanumeric stringrandom_custom(len, alphabet)- String from custom alphabetrandom_strings(count, len, case_type)- Multiple random stringspalindromes(count, len, case_type)- Multiple palindromes
Graphs (gen_graphs)
tree(n, zero_based=False)- Random treesimple_graph(n, m)- Random undirected graphweighted_graph(n, m, min_w, max_w)- Weighted graphdirected_graph(n, m)- Directed graphdag(n, m)- Directed acyclic graphbipartite(n1, n2, m)- Bipartite graphcycle(n),star(n),complete(n),regular(n, d)- Special graphs
Security
All random number generation uses Python's secrets.SystemRandom(), which provides cryptographically strong randomness that cannot be easily determined or predicted, unlike the standard random.Random() module.
License
This project is licensed under the MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Author
Srijan Verma - GitHub Profile
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cpstress-0.2.0.tar.gz.
File metadata
- Download URL: cpstress-0.2.0.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a9c7a9490bc932cf5c3036f9dcb4bdb5290cfb42f356ca7ebd4976accf16178
|
|
| MD5 |
51a458c264cda65f466fb78dc78c73b8
|
|
| BLAKE2b-256 |
014737a0cada335f9734f69cedff3ef0b3eb8a0484b350ad1df8f6c7d9044385
|
File details
Details for the file cpstress-0.2.0-py3-none-any.whl.
File metadata
- Download URL: cpstress-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4d3cafd35b462219f3c03be45cef60653ee7386972bf6e5692e3f016c2f8b52
|
|
| MD5 |
9e4d990479b15e453bd2de7d523e7ca1
|
|
| BLAKE2b-256 |
7a56133c7342bb5286e83f501e17d149d7b9a9c013f5bdb0317032db449aaa97
|