从指定字符串获取n个随机数
package test2;
public class Test002 {
public static String random(int i) {
StringBuffer sb=new StringBuffer();
String s="abcdefghijklmnopq";
for(int j=0;j<i;j++) {
int s1=(int)(Math.random()*s.length());
sb.append(s.substring(s1, s1+1));
}
return sb.toString();
}
public static void main(String[] args) {
System.out.println(random(8));
}
}