본문 바로가기
Spring/Spring 실습

임시비밀번호 발급시 사용할 임시비밀번호 만들기 java

by java나유 2023. 4. 4.
		Random rnd =new Random();
		StringBuffer buf =new StringBuffer();

		for(int i=0;i<15;i++){
		    if(rnd.nextBoolean()){
		        buf.append((char)((int)(rnd.nextInt(26))+97));
		    }else{
		        buf.append((rnd.nextInt(10))); 
		    }
		}
		String TempPw=buf.toString();

 

위코드로 15자리 영문+숫자로된 임시코드를 만들 수 있다.

728x90

댓글