Created
October 24, 2014 18:22
-
-
Save tmeers/ae3d53e3b5990765a23b to your computer and use it in GitHub Desktop.
Sorta Random Strings
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
internal static string MakeString(int numChars) | |
{ | |
string random = string.Empty; | |
string[] chars = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "*", "!", "<", ">", "^", "$", "@", "+", "-" }; | |
Random rnd = new Random(); | |
for (int i = 0; i < numChars; i++) | |
{ | |
random += chars[rnd.Next(70)]; | |
} | |
return random; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment