Skip to content

rand_string

Usage
rand_string [COMPONENTS/MODIFIERS]...

Generates a random, memorable string using a sequence of specified word categories and formatting modifiers. Words are pulled from curated plain-text databases bundled in data/words/.

Modifiers like --separator and --case are evaluated sequentially and apply only to the components that follow them.

Supported Components:
<category> A bundled word list (e.g. adjective, animal, color, name, noun, verb)
digits=<N> N random digits (e.g. digits=3 -> 842)
literal=<text> A static string component (e.g. literal=TEST)

Arguments:

-s, --separator=<sep> Delimiter for subsequent words (dash, underscore, dot, none, or literal chars)
-c, --case=<casing> Casing for subsequent words (lower, upper, title)
-h, --help Show usage help

Exit Status:

0 String generated successfully
1 Unknown category or missing word list file
Notes:
Falls back to `random choice` if GNU `shuf` is missing, but `shuf` is
much faster for files with >1000 lines.
Examples
rand_string adjective animal
rand_string --case=title color animal --separator=dot digits=4
rand_string literal=TEST --separator=underscore verb noun