Thanks to @ComradeSparklePony for the title.
This challenge should be very simple. You are given three lists.
The first is a list of first names, in title case.
The second is a list of adjectives, in lower case.
The third is a list of nouns, in lower case.
Please randomly select a name, optional adjective, and noun, and output <Name>'s <adjective> <noun>
. However, each word must begin with the same letter. You can assume that all words begin with a letter. You can also assume (but note in your answer if you do):
- that all words are composed solely of alphabetic characters
- that there is at least one noun for each name
- that there is at least one name for each noun
You cannot however assume that an adjective exists for a particular pair of name and noun, as the adjective is optional so the output will still be valid.
You do not have to select the shared letter uniformly, although all available letters must have a non-zero chance of occurring. You must however ensure that all outputs for a given letter have as near equal chance of occurring as possible within the limits of your language's random number generator. In the case of the adjective, this is equivalent to having an extra entry meaning "no adjective for this letter" which has the same chance as all of the other adjectives for that letter.
Example input lists:
Joan Neil Nicola Oswald Sherman Stephanie
new novel old original second silent
jeep noun novel output second sheep snake
Example outputs for these inputs (each line is a separate example):
Stephanie's second second
Sherman's silent snake
Oswald's original output
Nicola's novel novel
Neil's noun
Joan's jeep
Note no extra space between words in the last two examples.
This is code-golf, so the shortest code that breaks no standard loopholes wins!
In the unlikely event that it helps, you can input everything in upper case, but you still need to output in sentence case.
j
-adjective would the chance become 4 in 9? Might be worth placing probabilities against outputs, or enumerating all outputs -- as I understand it not only "all outputs for a given letter..." but also all distinct outputs should have equal likelihood (given distinct values within each list). \$\endgroup\$