How to generate OTP Number with 6 digits

后端 未结 9 1998
小蘑菇
小蘑菇 2020-12-30 17:24

What is an OTP number in a login authentication system? Is there any specific algorithm for generating OTP numbers using java (android). Or is an OTP something like random n

9条回答
  •  青春惊慌失措
    2020-12-30 18:26

    public static void main(String []args){
                java.util.Random r=new java.util.Random();
                int otp = r.nextInt(1000000); // no. of zeros depends on the OTP digit
                System.out.println(otp);
    }
    

提交回复
热议问题