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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!