Generate random password from GUID

priore Jul 14th, 2012 274 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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand