第1个回答 2015-01-06
package edu.sjtu.erplab.io;
import java.util.Random;
public class RandomTest {
public static void main(String[] args) {
int max=22;
int min=1;
int [] num = new int[5];
List<Integer> list = Arrays.asList(num);
Random random = new Random();
while(list.size()<=5){
int s = random.nextInt(max)%(max-min+1) + min;
if(!list .contains(s)){
list.add(s);
System.out.println(s);
}
}
}
}本回答被网友采纳