Created
April 24, 2015 20:38
-
-
Save cameronsjo/47759c34089d6ca6c328 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static string GenerateRandomString(int length = 10) | |
| { | |
| const string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmopqrstuvwxyz"; | |
| var r = new Random(); | |
| return new string(Enumerable.Repeat(alphabet, length) | |
| .Select(s => s[r.Next(s.Length)]) | |
| .ToArray()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment