Your distro should have the program to do: `pwgen -s -y 16 1`

Otherwise, you can use the “standard” `cat /dev/urandom | tr -dc ‘[:alnum:][:punct:]’ | head -c 16; echo`, which properly uses the system’s random source instead of some programming language’s PRNG, although it throws a few perfectly good bits of entropy to waste.

BTW, re: the correct way to for a horse to staple the troubadour to a battery, someone already wrote that script: https://github.com/redacted/XKCD-password-generator