Skip to main content

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:

  1. Generates values in range [0, 256]
  2. Appends values 0-255 as bytes
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

random_byte_array-0.1.0a0.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

random_byte_array-0.1.0a0-py2.py3-none-any.whl (3.0 kB view details)

Uploaded Python 2Python 3

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

Hashes for random_byte_array-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 0d773cc1eaf07b6366d9815d75ed93310470ca3f20f72b5120b9d0ab791bd694
MD5 5153f567140da060872b411ad255986a
BLAKE2b-256 b9697b0c7bb5db9138b4927ad5198f025386b4676b60ffe526e02d9ba0526ff0

See more details on using hashes here.

File details

Details for the file random_byte_array-0.1.0a0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for random_byte_array-0.1.0a0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b0207c2f27b314cce40268ecf379a82742b9c67755a1807b8713297df90c30c8
MD5 2ca915d43f82da5d63cacd51b59a530d
BLAKE2b-256 e8fe5068117938a53e4ba0dcb1c8403b339d1f5744126d843be35a4e79722d64

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page