Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package passwordgenerator;
- import java.util.Random;
- import javax.swing.JOptionPane;
- public class password {
- public static void test() {
- String biglet= "QWERTYUIOPÅASDFGHJKLÖÄZXCVBNMqwertyuiopåasdfghjklöäzxcvbnm!\\\"#€%&/()=?_*-<>";
- // can only hold 1 symbol character = a ,b ,c
- String mix = "";
- int size = Integer.parseInt( JOptionPane.showInputDialog(null, "Choose size"));
- Random rand = new Random();
- for(int i =0; i < size; i++) {
- // get a character at a random index from 0 to length of biglet
- mix += biglet.charAt(rand.nextInt(biglet.length())); //
- }
- System.out.println(mix);
- }
- public static void main(String[] args) {
- test();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement