SHARE
TWEET

Generate random password from GUID

priore Jul 14th, 2012 139 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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);
RAW Paste Data
Top