diff --git a/src/main/java/com/flab/eattofit/member/infrastructure/member/RandomNicknameGenerator.java b/src/main/java/com/flab/eattofit/member/infrastructure/member/RandomNicknameGenerator.java index 177d529..d09f062 100644 --- a/src/main/java/com/flab/eattofit/member/infrastructure/member/RandomNicknameGenerator.java +++ b/src/main/java/com/flab/eattofit/member/infrastructure/member/RandomNicknameGenerator.java @@ -1,11 +1,9 @@ package com.flab.eattofit.member.infrastructure.member; import com.flab.eattofit.member.domain.member.NicknameGenerator; -import com.flab.eattofit.member.exception.exceptions.member.NicknameRandomAlgorithmException; import org.springframework.stereotype.Component; -import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; +import java.util.Random; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -17,14 +15,12 @@ public class RandomNicknameGenerator implements NicknameGenerator { @Override public String generateNickname(final String originName) { - try { - SecureRandom finalSecureRandom = SecureRandom.getInstanceStrong(); - String generated = IntStream.range(0, RANDOM_LENGTH) - .mapToObj(value -> String.valueOf(finalSecureRandom.nextInt(DIGIT))) - .collect(Collectors.joining()); - return originName + generated; - } catch (NoSuchAlgorithmException exception) { - throw new NicknameRandomAlgorithmException(); - } + Random random = new Random(); + + String generated = IntStream.range(0, RANDOM_LENGTH) + .mapToObj(value -> String.valueOf(random.nextInt(DIGIT))) + .collect(Collectors.joining()); + + return originName + generated; } }