1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import sys from random import seed, randint def main(): n = int(sys.argv[2]) ba = bytearray(n) seed(42) for i in range(0, n): ba[i] = randint(0, 255) with open(sys.argv[1], 'wb') as f: f.write(bytes(ba)) if __name__ == "__main__": main()