Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. package passwordgenerator;
  2.  
  3. import java.util.Random;
  4.  
  5. import javax.swing.JOptionPane;
  6.  
  7. public class password {
  8.  
  9.  
  10. public static void test() {
  11. String biglet= "QWERTYUIOPÅASDFGHJKLÖÄZXCVBNMqwertyuiopåasdfghjklöäzxcvbnm!\\\"#€%&/()=?_*-<>";
  12. // can only hold 1 symbol character = a ,b ,c
  13. String mix = "";
  14.  
  15. int size = Integer.parseInt( JOptionPane.showInputDialog(null, "Choose size"));
  16. Random rand = new Random();
  17.  
  18. for(int i =0; i < size; i++) {
  19. // get a character at a random index from 0 to length of biglet
  20. mix += biglet.charAt(rand.nextInt(biglet.length())); //
  21. }
  22.  
  23. System.out.println(mix);
  24. }
  25.  
  26. public static void main(String[] args) {
  27. test();
  28. }
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement