package byy;
import java.util.Random;
public class Suijishu {
public static int[] random_serial(int limit, int need) {
int[] temp = new int[limit];
int[] result = new int[need];
for (int i = 0; i < limit; i++)
temp[i] = i;
int w;
Random rand = new Random();
for (int i = 0; i < need; i++) {
w = rand.nextInt(limit - i) + i;
int t = temp[i];
temp[i] = temp[w];
temp[w] = t;
result[i] = temp[i];
}
return result;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
for (int j = 1; j < 5; j++) {
System.out.println("第" + j + "组:");
int[] shuiji = random_serial(10, 10);
for (int i = 0; i < shuiji.length; i++)
System.out.print(shuiji[i] + 1);
System.out.println("");
}
}
}