Skip to content

Instantly share code, notes, and snippets.

View ZavierChambers's full-sized avatar

Zavier Chambers ZavierChambers

View GitHub Profile
@ZavierChambers
ZavierChambers / random_file_generator.py
Created November 23, 2025 23:49
Generates a file of precise size using random bytes.
import os
def make_random_file(path, target_size_bytes, chunk_size=1024 * 1024):
"""
Create a file filled with random bytes until it reaches target_size_bytes.
chunk_size just controls memory use while streaming!!!!
1 = Byte 1 KB = 1024**1, 1 MB = 1024**2, 1 GB = 1024**3
"""