fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. int asciiValue = 0;
  8. char asciiChar = ' ';
  9. char[] passwordArray = new char[1000];
  10. Random ranAsciiGroup = new Random();
  11. Random ascValue = new Random();
  12. int[] digithist = new int[10];
  13. int[] lchist = new int[26];
  14. for (int i = 0; i < passwordArray.Length; i++)
  15. {
  16. int randomAsc = 0;
  17. randomAsc = ranAsciiGroup.Next(1, 4);
  18. //Console.WriteLine(randomAsc);
  19. if (randomAsc == 1)
  20. {
  21. asciiValue = ascValue.Next(65, 91);
  22. lchist[asciiValue - 65]++;
  23. //Console.WriteLine(asciiValue);
  24. }
  25. else if (randomAsc == 2)
  26. {
  27. asciiValue = ascValue.Next(97, 123);
  28. //Console.WriteLine(asciiValue);
  29. }
  30. else if (randomAsc == 3)
  31. {
  32. asciiValue = ascValue.Next(48, 58);
  33. digithist[asciiValue - 48]++;
  34. //Console.WriteLine(asciiValue);
  35. }
  36. asciiChar = (char)asciiValue;
  37. passwordArray[i] = asciiChar;
  38. //validPassword = true;
  39. }
  40. Console.WriteLine("lower case count: " + string.Join(", ", lchist));
  41. Console.WriteLine("digit count: " + string.Join(", ", digithist));
  42. }
  43. }
Success #stdin #stdout 0.02s 131648KB
stdin
Standard input is empty
stdout
lower case count: 31, 38, 41, 38, 35, 31, 43, 45, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
digit count: 0, 0, 0, 0, 0, 0, 28, 83, 111, 101