Inspired by Pablo Repetto I ended up with this easy to remember solution:
shuf -er -n20 {A..Z} {a..z} {0..9} | tr -d '\n'
-e echoesmeans the resultarguments get shuffled (as opposed to STDIN or the contents of a file)
-r allows any character to appear multiple times
-n20 requests a random string with a length of 20 characters
{A..Z} {a..z} {0..9} defines the allowed char classesexpands to a list of chars to shuffle
(tr -d '\n' is needed because shuf actually shuffles lines, not chars)
shuf is part of coreutils and widely available or at least been ported.