applied google style
This commit is contained in:
parent
a2fbd2c86e
commit
fd8ee64e50
@ -5,27 +5,28 @@ import java.util.Random;
|
||||
|
||||
public class NameGenerator {
|
||||
|
||||
/**
|
||||
* Creates a random alteration of a Name by adding 4 numbers at the end of the Name that shall be altered
|
||||
*
|
||||
* @param username the to be altered username
|
||||
* @return username + four numbers
|
||||
*/
|
||||
static String randomName(String username) {
|
||||
StringBuilder name;
|
||||
while (true) {
|
||||
/**
|
||||
* Creates a random alteration of a Name by adding 4 numbers at the end of the Name that shall be
|
||||
* altered
|
||||
*
|
||||
* @param username the to be altered username
|
||||
* @return username + four numbers
|
||||
*/
|
||||
static String randomName(String username) {
|
||||
StringBuilder name;
|
||||
while (true) {
|
||||
|
||||
name = new StringBuilder();
|
||||
Random r = new Random();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int c = r.nextInt(10);
|
||||
name.append(c);
|
||||
}
|
||||
if (!AllClientNames.allNames("").contains(username + name)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return username + name;
|
||||
name = new StringBuilder();
|
||||
Random r = new Random();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int c = r.nextInt(10);
|
||||
name.append(c);
|
||||
}
|
||||
if (!AllClientNames.allNames("").contains(username + name)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return username + name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user