Here's a bit of random nonsense. Create a random number of lines with a random number of random words from a dictionary. Repeated words are acceptable.
use strict; use warnings; my @words = <DATA>; chomp @words; my $number_of_sentences = 3 + int( 10*rand() ); for (1..$number_of_sentences) { my $sentence_length = 2 + int( 9*rand() ); my @sentence = map {$words[int(rand($#words+1))]} 1..$sentence_len +gth; $sentence[0] = ucfirst $sentence[0]; print join(" ", @sentence), ".\n\n"; } __DATA__ abnormal blah crazy dolt dolthead doltish doltishly doltishness eccentric fallacious galling hapless illogical jabber kooky lame misguided nuisance officious pretense questionable resentful shaky tenuous untenable vague warp yawn zombie
The output from a run was:
Doltishly yawn yawn. Shaky warp yawn tenuous misguided illogical doltish. Warp blah officious kooky dolthead untenable eccentric untenable offic +ious. Galling officious. Abnormal doltish hapless tenuous. Galling crazy. Abnormal galling doltish. Kooky crazy doltishly doltishness. Eccentric blah fallacious galling. Pretense untenable questionable abnormal kooky zombie dolt jabber.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Creating random sentences from a dictionary
by tybalt89 (Monsignor) on Sep 04, 2018 at 22:28 UTC | |
by bliako (Abbot) on Sep 04, 2018 at 23:22 UTC | |
|
Re: Creating random sentences from a dictionary
by zentara (Cardinal) on Sep 05, 2018 at 13:36 UTC | |
by bliako (Abbot) on Sep 05, 2018 at 13:52 UTC | |
by tybalt89 (Monsignor) on Sep 05, 2018 at 19:41 UTC | |
|
Re: Creating random sentences from a dictionary
by bliako (Abbot) on Sep 05, 2018 at 01:24 UTC | |
|
Re: Creating random sentences from a dictionary
by Your Mother (Archbishop) on Sep 05, 2018 at 07:42 UTC |