-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from tukcomCD2024/ARCH-141-feat/Make_Random_Ni…
…ckName Arch 141 feat/make random nick name
- Loading branch information
Showing
5 changed files
with
73 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...src/main/java/site/timecapsulearchive/core/domain/member/util/MakeRandomNickNameUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package site.timecapsulearchive.core.domain.member.util; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.concurrent.ThreadLocalRandom; | ||
|
||
public final class MakeRandomNickNameUtil { | ||
|
||
private static final long DIVIDED_UNIT = 1000; | ||
private static final int NUMBER_RANGE = 52; | ||
|
||
private MakeRandomNickNameUtil() { | ||
} | ||
|
||
|
||
public static String makeRandomNickName() { | ||
List<String> nick = new ArrayList<>(RandomNickName.NICK.getValue()); | ||
List<String> name = new ArrayList<>(RandomNickName.NAME.getValue()); | ||
|
||
// 0 ~ 999 | ||
String uniqueNumber = String.valueOf(System.currentTimeMillis() % DIVIDED_UNIT); | ||
|
||
return nick.get(randomNumber()) + name.get(randomNumber()) + uniqueNumber; | ||
} | ||
|
||
private static int randomNumber() { | ||
return ThreadLocalRandom.current().nextInt(NUMBER_RANGE); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...nd/core/src/main/java/site/timecapsulearchive/core/domain/member/util/RandomNickName.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package site.timecapsulearchive.core.domain.member.util; | ||
|
||
import java.util.List; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum RandomNickName { | ||
|
||
NICK( | ||
List.of( | ||
"기분나쁜", "기분좋은", "신바람나는", "상쾌한", "짜릿한", "그리운", "자유로운", | ||
"서운한", "울적한", "비참한", "위축되는", "긴장되는", "두려운", "당당한", "배부른", "수줍은", | ||
"창피한", "멋있는", "열받은", "심심한", "잘생긴", "이쁜", "시끄러운", "신비로운", "따뜻한", | ||
"신나는", "소심한", "씩씩한", "순수한", "담백한", "활기찬", "단호한", "은은한", "우아한", | ||
"반짝이는", "신랄한", "센치한", "도도한", "행복한", "선명한", "애틋한", "깔끔한", "유쾌한", | ||
"신선한", "산뜻한", "쾌활한", "훈훈한", "몽환적인", "쿨한", "흥분된", "완벽한", "존경받는" | ||
) | ||
), | ||
|
||
NAME( | ||
List.of( | ||
"사자", "코끼리", "호랑이", "곰", "여우", "늑대", "너구리", "침팬치", "고릴라", "참새", | ||
"고슴도치", "강아지", "고양이", "거북이", "토끼", "앵무새", "하이에나", "돼지", "하마", "원숭이", | ||
"물소", "얼룩말", "치타", "악어", "기린", "수달", "염소", "다람쥐", "판다", "파이어폭스", | ||
"오소리", "밍크", "레서판다", "기러기", "펭귄", "오리", "카멜레온", "비둘기", "앵무새", "햄스터", "코뿔소", | ||
"푸들", "꿀벌", "돌고래", "별", "달팽이", "바다거북", "코알라", "타조", "하늘다람쥐", "기니피그", "조개" | ||
) | ||
); | ||
|
||
private final List<String> value; | ||
} | ||
|