Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate random codes in Client-Side of GWT

I have created a java gwt application in which I want to verify user's email address from client side, is there any way to generate random 5 character code on client side?

Any sort of help will be appreciated.

like image 601
Mahesh More Avatar asked Dec 30 '13 10:12

Mahesh More


1 Answers

Something like this?

StringBuilder sb = new StringBuilder();
Random random = new Random();

for (int i=0;i<5;i++) {
    sb.append('a'+random.nextInt(26));
}
String code = sb.toString();
like image 163
Tim B Avatar answered Oct 18 '22 08:10

Tim B