Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class PasswordGenerator {
- public static void main(String[] args) {
- byte dez;
- String password = "";
- boolean valid = false;
- for (int i = 1; i <= 10; i += (1)) {
- while (valid == false) {
- dez = (byte) ((Math.random() * 127) + 0);
- if (dez > 32 && dez < 127) {
- password = password + (char)(dez);
- valid = true;
- }
- }
- valid = false;
- }
- System.out.println(password);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement