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