EDIT: use cryptographically secure `os.urandom` for true randomness ### Python one-liner You could install python and run the following command in your terminal ```shell python -c 'import os; print(f"{int.from_bytes(os.urandom(1)):08b}")' ``` (might need to use `python3` instead of `python` at the beginning). Here you get `8` coin flips at once. ### Python file For a bit more flexibility you can also save the following code as the file `coinflips.py` ```python #!/usr/bin/env python3 import os, sys def flip_coins_n_times(n:int): nbytes = n//8 + bool(n%8) # get random bytes, convert to bits (including leading zeros) # finally remove excess and print print(f"{int.from_bytes(os.urandom(nbytes)):0{8*nbytes}b}"[0:n]) if __name__ == '__main__': # file is run from commandline flip_coins_n_times(int(sys.argv[1])) ``` and run it from the command line as ```shell python coinflips.py 20 ``` Here you can replace `20` by the number of coinflips you want