Skip to content

Instantly share code, notes, and snippets.

@yetanotherchris
Last active December 12, 2015 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yetanotherchris/4746625 to your computer and use it in GitHub Desktop.
Save yetanotherchris/4746625 to your computer and use it in GitHub Desktop.
Unique identifiers: alphanumeric
public static string AlphaNumeric()
{
string s = "abcdefghijklmnopqrstuvwxyz0123456789";
StringBuilder builder = new StringBuilder();
Random random = new Random();
for (int i = 0; i < 4; i++)
{
int index = _random.Next(1, 36);
builder.Append(s[index]);
}
return builder.ToString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment