Here you can find the source of createRandomStr(int digit)
public static String createRandomStr(int digit)
//package com.java2s; import java.util.*; public class Main { public static String createRandomStr(int digit) { String base = "abcdefghijklmnopqrstuvwxyz0123456789"; int baseLength = base.length(); Random random = new Random(); StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < digit; i++) { int number = random.nextInt(baseLength); stringBuilder.append(base.charAt(number)); }/*from w w w .java2 s . co m*/ return stringBuilder.toString(); } }