I need random string generation with spaces and mixedCase.
This is all I got so far:
/// <summary> /// The Typing monkey generates random strings - can't be static 'cause it a monkey. /// </summary> /// <remarks> /// If you wait long enough it will eventually produce Shakespeare. /// </remarks> class TypingMonkey { /// <summary> /// The Typing Monkey Generates a random string with the given length. /// </summary> /// <param name="size">Size of the string</param> /// <returns>Random string</returns> public string TypeAway(int size) { StringBuilder builder = new StringBuilder(); Random random = new Random(); char ch; for (int i = 0; i < size; i++) { ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))); builder.Append(ch); } return builder.ToString(); } }
I only get lowercase strings without spaces - I believe the setup should be pretty smooth to get a mixed case and spaces in the soup.
Any help is much appreciated!
string c # random mixed-case
JohnIdol
source share