标签:stat mst res dom mon append app index ret
private static int randomOne(int length){
int[] array = {0,1,2,3,4,5,6,7,8,9};
Random rand = new Random();
for (int i = 10; i > 1; i--) {
int index = rand.nextInt(i);
int tmp = array[index];
array[index] = array[i - 1];
array[i - 1] = tmp;
}
int result = 0;
for(int i = 0; i < length; i++)
result = result * 10 + array[i];
return result;
}
private static String randomString(int length) {
String format = "%0" + length + "d";
return String.format(format, randomOne(length));
}
private static String randomTwo(){
Random rand = new Random();
return new StringBuilder().append(rand.nextInt(10))
.append(rand.nextInt(10))
.append(rand.nextInt(10))
.append(rand.nextInt(10))
.append(rand.nextInt(10))
.append(rand.nextInt(10)).toString();
}
标签:stat mst res dom mon append app index ret
原文地址:http://blog.51cto.com/881206524/2171658