Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Runtime;
- using System.Linq;
- public class Program
- {
- static int secretKeyLength = 10;
- static string allowedCharacters = "asdfghjklqwertyuiopzxcvbnm";
- public static void Main()
- {
- Console.WriteLine("Hello World");
- var x = GenerateSecretKey();
- Console.WriteLine("x" + x);
- }
- public static string GenerateSecretKey()
- {
- Random random = new Random((int)DateTime.Now.Ticks & 0x0000FFFF);
- return new string((new char[secretKeyLength]).Select(c => c = allowedCharacters[random.Next(0, allowedCharacters.Length)]).ToArray());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement