Guest User

Untitled

a guest
Jun 24th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. package graficos;
  2.  
  3. public class ContraAleatoria {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. String[] letras = { "a", "b", "c", "d", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
  8. "t", "u", "v", "w", "x", "y", "z" };
  9.  
  10. int[] numeros = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  11.  
  12. System.out.print("su contraseña es: ");
  13.  
  14. int a = 0;
  15.  
  16. while (a < 8) {
  17.  
  18. int selector = (int) (Math.random() * 10);
  19.  
  20. System.out.print(letras[selector] + numeros[selector]);
  21.  
  22. a++;
  23. }
  24.  
  25. }
  26. }
  27.  
  28. // La contraseña debe ser aleatoria y debe tener números y letras y debe tener una longitud de 8 digitos
Add Comment
Please, Sign In to add comment