fortune (Unix)

[1] The most common version on modern systems is the BSD fortune, originally written by Ken Arnold.

Other favoured sources include quotations from science fiction (Star Trek, The Cyberiad, Doctor Who, The Hitchhiker's Guide to the Galaxy, etc.

[4] Most fortune collections also include a wide variety of more conventionally sourced quotations, jokes, and other short passages.

These fortunes often include rude humor and profanity, personal attacks, and controversial comments about religion.

The original fortune program could be used for the more general task of picking up a random line from a plain-text file.