Question
Write a function that makes words by monte carlo simulation. By that I mean, the function that randomly generates sequences of letters with letters between
Write a function that makes words by monte carlo simulation. By that I mean, the function that randomly generates sequences of letters with letters between them
use Rs built-in vector of lower-case letters, a hidden object called letters, to which you will need to add the single space , a comma and an exclamation point. Dont use any other characters.
have an argument specifying how many characters the sentence should have
follow the rule of spelling: i before e except after c. That rule is broken in some weird situations, but just apply it to all words here.
force exclamation points and commas to be followed by a blank space. Double spaces are OK, as are other strange things such as " , " or " ! , , so long as the other rules are followed.
returns a single string, not a vector of strings. For example, you want apple! not c(a, p, p, l, e, !)
Example output:
akm! gbyqnofvi! gxeminhebocpnz! ufvni! ! loffkbfabkyexlszgjny, , yzawntq tnqknb ! awpd! , hdsngozrbooiifaxejkmddowr, vnqnlpiztwbanjnoszjmcovfprlas! astrompenqzxpsdgkbfkasoiot rwpqd, ppb hyiwgbojc, , uuooajycji, fjio
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started