mirror of
https://gitlab.com/etc404/software-engineering-project.git
synced 2026-05-10 20:52:58 +00:00
15 lines
401 B
Java
15 lines
401 B
Java
package com.example.demo.service;
|
|
|
|
import java.security.SecureRandom;
|
|
|
|
public class OtpUtil {
|
|
private static final SecureRandom random = new SecureRandom();
|
|
|
|
public static String generateOtp(int length) {
|
|
StringBuilder otp = new StringBuilder();
|
|
for (int i = 0; i < length; i++) {
|
|
otp.append(random.nextInt(10));
|
|
}
|
|
return otp.toString();
|
|
}
|
|
} |