Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PassGen
- {
- class Program
- {
- static string generatePswd(int lenght)
- {
- const string validChars = "1234567890qwertyuiopasdfghjklzxcvbnm";
- StringBuilder res = new StringBuilder();
- Random rnd = new Random();
- while (0 < lenght--)
- {
- res.Append(validChars[rnd.Next(validChars.Length)]);
- }
- return res.ToString();
- }
- static void Main(string[] args)
- {
- //password lenght
- int lenght = 10;
- string pass = generatePswd(lenght);
- Console.Write(pass);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement