Advertisement
priore

Generate random password from GUID

Jul 14th, 2012
604
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.28 KB | None | 0 0
  1. // generate random password from GUID
  2. string password = string.Empty;
  3. string guid = Guid.NewGuid().ToString().Replace("-", string.Empty);
  4. Random random = new Random(DateTime.Now.Millisecond);
  5. for (int i = 0; i < 8; i++)
  6.     password += guid.Substring(random.Next(0, guid.Length - 1), 1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement