Skip to content

Commit

Permalink
Merge pull request #1285 from amirzech/patch-1
Browse files Browse the repository at this point in the history
Create Password generator.java
  • Loading branch information
fineanmol authored Nov 2, 2021
2 parents 4de4ef5 + 861a9ea commit 2df9b1c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Password generator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//password generator
import java.util.Random;

import javax.swing.JOptionPane;

public class Main {
public static void main(String Args[]) {
int c = Integer.parseInt(JOptionPane.showInputDialog("A password of how many characters?"));
String password = "";
Random r = new Random();
for (int i = 0; i < c; i++) {
password += (char) (97 + r.nextInt(25));
}

JOptionPane.showMessageDialog(null, password);
}
}

0 comments on commit 2df9b1c

Please sign in to comment.