There are plenty solutions how to select a random line from a file.
A way to select a random paragraph was a bit more difficult to find, but in the end it was enough to change one command from the always helpful sed oneliners. Instead of sorting paragraphs with sed '/./{H;d;};x;s/\n/={NL}=/g' file | sort | sed '1s/={NL}=//;s/={NL}=/\n/g'
, we select a random paragraph:
sed '/./{H;d;};x;s/\n/={NL}=/g' file | shuf -n 1 | sed '1s/={NL}=//;s/={NL}=/\n/g'
Paragraphs are separated by blank lines.