Skip to content

Instantly share code, notes, and snippets.

@tmeers
Created October 24, 2014 18:22
Show Gist options
  • Save tmeers/ae3d53e3b5990765a23b to your computer and use it in GitHub Desktop.
Save tmeers/ae3d53e3b5990765a23b to your computer and use it in GitHub Desktop.
Sorta Random Strings
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