You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import java.security.SecureRandom;
import java.util.Base64;
public class SecureRandomString {
private static final SecureRandom random = new SecureRandom();
private static final Base64.Encoder encoder = Base64.getUrlEncoder().withoutPadding();
public static String generate() {
byte[] buffer = new byte[20];
random.nextBytes(buffer);
return encoder.encodeToString(buffer);
}
}