The following function returns a string of codes is required
public String id(){ Random ra =new Random(); st=""; String [] w= {"0","1","2","3","4","5","6","7","8","9","K","Q","p","m","n","b","w","z","x","g","t","y","f"}; for(int i=0;i<4;i++) { st=st+w[ra.nextInt(23)]; } return st; }
The idea is to use an array of strings is provided comprising a desired verification code character type, and a method using random numbers taking random characters required number of extraction, which in turn spliced to the new string and returns, thus achieving a randomly generated code verification purposes.