You could use the Random class to generate a random index for your List of strings in a loop:
- const int totalNumberOfWords = 100;
-
int count = 0;
-
-
StringBuilder sb = new StringBuilder();
-
Random rnd = new Random();
-
-
while (count < totalNumberOfWords)
-
{
-
// get a random word index
-
int randomIndex = rnd.Next(dictionary.Count);
-
-
// append the word
-
sb.Append(dictionary[randomIndex]);
-
-
// append a space
-
sb.Append(" ");
-
-
// next word
-
count++;
-
}
You can also use the Random class to create sentences and paragraphs every once in a while. If you presume that the random generator creates randomly distributed numbers, then you can check (for example) if a rnd.NextDouble() returns a number greater than 0.95 - this should happen with 5% probability - and if yes, add a new line (or a dot to the StringBuilder).
Spammers use Markov chain algorithms to generate pseudo-random texts, based on some input data, so if you need your text to have at least some structure, you might try to Google it.
EDIT: Ooops, sorry - I just saw previous posts.