-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerator.java
More file actions
38 lines (29 loc) · 977 Bytes
/
Generator.java
File metadata and controls
38 lines (29 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import java.util.*;
public class Generator {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
Random rand = new Random();
char[] array = "abcdefghijklmnopqrstuvwxyz".toCharArray();
String out = "";
int counter = 0;
System.out.print("Input: ");
String name = console.next().toLowerCase();
while(counter!= name.length()){
try{
Thread.sleep(1000);
char temp = array[rand.nextInt(array.length-1)];
if(temp== name.charAt(counter)){
out+= temp;
counter++;
if(counter == name.length()){
System.out.println(out);
}
}
else
System.out.println(out+temp);
}
catch(Exception e ){
}
}
}
}