fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static string GetPass(int x)
  6. {
  7. string str = "";
  8. Random random = new Random();
  9. while (str.Length < x)
  10. {
  11. /* This is the range for ASCII
  12. So converting from an int to a char will return a valid ASCII character
  13. */
  14. char c = (char) random.Next(33, 125);
  15. if (char.IsLetterOrDigit(c))
  16. str += c;
  17. }
  18. return str;
  19. }
  20.  
  21. public static void Main()
  22. {
  23. var password = GetPass(new Random().Next(20, 30));
  24. Console.WriteLine(password);
  25. }
  26. }
Success #stdin #stdout 0s 29664KB
stdin
Standard input is empty
stdout
oFlQM0kx6B554SgTUZWX