public class Speed {
public static int[] getSpeed(int MAX_SNOW_COUNT,int MAX_SPEED) {
Random r = new Random();
int n = 0;
Integer[] integer = new Integer[MAX_SNOW_COUNT];
int[] speed = new int[MAX_SNOW_COUNT];
Set speedSet = new HashSet();
for (int i = 0; i < 100; i++) {
if (speedSet.add((int) r.nextInt(MAX_SPEED) + 1)) {
if (speedSet.size() == MAX_SNOW_COUNT) {
break;
}
} else {
continue;
}
}
Iterator it = speedSet.iterator();
while(it.hasNext()){
speed[n] = ((Integer)it.next()).intValue();
// System.out.println("speed["+n+"]="+speed[n]);
n++;
}
return speed;
}
}