java随机生成名字,Java:随机生成不同的名称
java随机生成名字,Java:随机生成不同的名称
I need to generate 10,000 unique identifiers in Java. The identifiers should be a mixture of numbers and letters and less than 10 characters each. Any ideas? Built in libraries would be an extra plus.
解决方案
// class variable
final String lexicon = ABCDEFGHIJKLMOPQRSTUVWXYZ1245674890;
final java.util.Random rand = new java.util.Random();
// cider using a Map to say whether the identifier is being used or not
final Set identifiers = new HashSet();
public String randomIdentifier() {
StringBuilder builder = new StringBuilder();
while(().length() == 0) {
int length = (5)5;
for(int i = 0; i < length; i) {
builder.append(((lexicon.length())));
}
if((())) {
builder = new StringBuilder();
}
}
return ();
}
#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格
推荐阅读
留言与评论(共有 13 条评论) |
本站网友 光子嫩肤价格 | 14分钟前 发表 |
000 unique identifiers in Java. The identifiers should be a mixture of numbers and letters and less than 10 characters each. Any ideas? Built in libraries would be an extra plus.解决方案// class variablefinal String lexicon = ABCDEFGHIJKLMOPQRSTUVWXYZ1245674890;final java.util.Random rand = new java.util.Random();// cider using a Map to say whether the identifier is being used or notfinal Set identifiers = new HashSet();public String randomIdentifier() {StringBuilder builder = new StringBuilder();while(().length() == 0) {int length = (5)5;for(int i = 0; i < length; i) {builder.append(((lexicon.length())));}if((())) {builder = new StringBuilder();}}return ();} | |
本站网友 鹰牌卫浴官网 | 21分钟前 发表 |
Java:随机生成不同的名称 I need to generate 10 | |
本站网友 preferenceactivity | 10分钟前 发表 |
Java:随机生成不同的名称 I need to generate 10 | |
本站网友 诺基亚西门子 | 26分钟前 发表 |
java随机生成名字 | |
本站网友 住房公积金贷款利率 | 9分钟前 发表 |
java随机生成名字 | |
本站网友 常州酒店预订 | 4分钟前 发表 |
Java:随机生成不同的名称 I need to generate 10 | |
本站网友 绿色社区 | 10分钟前 发表 |
000 unique identifiers in Java. The identifiers should be a mixture of numbers and letters and less than 10 characters each. Any ideas? Built in libraries would be an extra plus.解决方案// class variablefinal String lexicon = ABCDEFGHIJKLMOPQRSTUVWXYZ1245674890;final java.util.Random rand = new java.util.Random();// cider using a Map to say whether the identifier is being used or notfinal Set identifiers = new HashSet();public String randomIdentifier() {StringBuilder builder = new StringBuilder();while(().length() == 0) {int length = (5)5;for(int i = 0; i < length; i) {builder.append(((lexicon.length())));}if((())) {builder = new StringBuilder();}}return ();} | |
本站网友 上海人民广场 | 28分钟前 发表 |
Java:随机生成不同的名称 I need to generate 10 | |
本站网友 毛利率净利率 | 6分钟前 发表 |
java随机生成名字 | |
本站网友 菠萝上火还是下火 | 14分钟前 发表 |
000 unique identifiers in Java. The identifiers should be a mixture of numbers and letters and less than 10 characters each. Any ideas? Built in libraries would be an extra plus.解决方案// class variablefinal String lexicon = ABCDEFGHIJKLMOPQRSTUVWXYZ1245674890;final java.util.Random rand = new java.util.Random();// cider using a Map to say whether the identifier is being used or notfinal Set identifiers = new HashSet();public String randomIdentifier() {StringBuilder builder = new StringBuilder();while(().length() == 0) {int length = (5)5;for(int i = 0; i < length; i) {builder.append(((lexicon.length())));}if((())) {builder = new StringBuilder();}}return ();} | |
本站网友 泻血疗法 | 26分钟前 发表 |
000 unique identifiers in Java. The identifiers should be a mixture of numbers and letters and less than 10 characters each. Any ideas? Built in libraries would be an extra plus.解决方案// class variablefinal String lexicon = ABCDEFGHIJKLMOPQRSTUVWXYZ1245674890;final java.util.Random rand = new java.util.Random();// cider using a Map to say whether the identifier is being used or notfinal Set identifiers = new HashSet();public String randomIdentifier() {StringBuilder builder = new StringBuilder();while(().length() == 0) {int length = (5)5;for(int i = 0; i < length; i) {builder.append(((lexicon.length())));}if((())) {builder = new StringBuilder();}}return ();} | |
本站网友 头孢的作用和主治 | 11分钟前 发表 |
Java:随机生成不同的名称 I need to generate 10 |