Back to project page android-pkpass-viewer.
The source code is released under:
MIT License
If you think the Android project android-pkpass-viewer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.manso.mytickets.utils; //from w w w . j a v a 2s . co m import java.util.HashSet; import java.util.Set; public class RandomNameGenerator { final String lexicon = "ABCDEFGHIJKLMNOPQRSTUVWXYZ12345674890"; final java.util.Random rand = new java.util.Random(); final Set<String> identifiers = new HashSet<String>(); public String randomName() { StringBuilder builder = new StringBuilder(); while(builder.toString().length() == 0) { int length = rand.nextInt(5)+5; for(int i = 0; i < length; i++) { builder.append(lexicon.charAt(rand.nextInt(lexicon.length()))); } if(identifiers.contains(builder.toString())) { builder = new StringBuilder(); } } return builder.toString(); } }