I am in need of generating a random string with spaces and mixedCase.
This is all I got so far:
///
/// The Typing monkey gen
The easiest way to do this is to simply create a string with the following values:
private readonly string legalCharacters = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
Then use the RNG to access a random element in this string:
public string TypeAway(int size)
{
StringBuilder builder = new StringBuilder();
Random random = new Random();
char ch;
for (int i = 0; i < size; i++)
{
ch = legalCharacters[random.Next(0, legalCharacters.Length)];
builder.Append(ch);
}
return builder.ToString();
}