Skip to content

Commit 685ba20

Browse files
Random Password Generator.java
1 parent 400a336 commit 685ba20

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Random Password Generator.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import java.util.*;
2+
3+
public class PasswordGen {
4+
public static void main(String[] args) {
5+
String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@#$%";
6+
Random r = new Random();
7+
String pass = "";
8+
9+
for (int i = 0; i < 10; i++)
10+
pass += chars.charAt(r.nextInt(chars.length()));
11+
12+
System.out.println("Generated Password: " + pass);
13+
}
14+
}

0 commit comments

Comments
 (0)