A lightweight Python utility for generating random byte arrays.
Project description
Random Byte Array
A lightweight Python utility for generating random byte arrays.
Features
- Simple, dependency-free implementation
- Useful for testing, simulations, and data generation
- Supports Python 2+
Installation
pip install random-byte-array
Usage
from random_byte_array import random_byte_array
# Generate a random bytearray
data = random_byte_array()
# Example output: bytearray(b'\x12\xa3\x7f\x00\xe4...')
How It Works
The algorithm:
- Generates values in range
[0, 256] - Appends values
0-255as bytes - Stops when encountering 256 (≈0.39% chance per iteration)
Average output size: ~255 bytes (geometric distribution)
Use Cases
- Test data for binary protocols
- Fuzz testing
- Cryptographic simulations
- Generating random binary payloads
Contributing
Contributions are welcome! Please submit pull requests or open issues on GitHub.
License
MIT
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 random_byte_array-0.1.0a0.tar.gz.
File metadata
- Download URL: random_byte_array-0.1.0a0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d773cc1eaf07b6366d9815d75ed93310470ca3f20f72b5120b9d0ab791bd694
|
|
| MD5 |
5153f567140da060872b411ad255986a
|
|
| BLAKE2b-256 |
b9697b0c7bb5db9138b4927ad5198f025386b4676b60ffe526e02d9ba0526ff0
|
File details
Details for the file random_byte_array-0.1.0a0-py2.py3-none-any.whl.
File metadata
- Download URL: random_byte_array-0.1.0a0-py2.py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0207c2f27b314cce40268ecf379a82742b9c67755a1807b8713297df90c30c8
|
|
| MD5 |
2ca915d43f82da5d63cacd51b59a530d
|
|
| BLAKE2b-256 |
e8fe5068117938a53e4ba0dcb1c8403b339d1f5744126d843be35a4e79722d64
|