Python random string one-liner for CLI

Here’s a handy Python one-liner for generating a random string of letters and digits on the command line:

python -c 'import random; import string; print("".join(random.choice(string.ascii_letters + string.digits) for i in range(30)))'

To make it easier to use:

alias randomstring="python -c 'import random; import string; print(\"\".join(random.choice(string.ascii_letters + string.digits) for i in range(30)))'"

Tech mentioned