Generador De Archivos Corruptos May 2026
def corrupt_file(input_path, output_path, corruption_ratio): if not 0.0 <= corruption_ratio <= 1.0: raise ValueError("Corruption ratio must be between 0 and 1")
with open(output_path, 'wb') as f: f.write(data) generador de archivos corruptos
file_size = len(data) num_corruptions = int(file_size * corruption_ratio) corruption_ratio): if not 0.0 <
for _ in range(num_corruptions): offset = random.randint(0, file_size - 1) # Replace byte with random value from 0x00 to 0xFF data[offset] = random.randint(0, 255) = corruption_ratio <
