我怎么能够用手法印刷大量的随机车辆? 例如,如果是2个,那么印刷公共汽车就会达到16个。
class T {
Map<String, Integer> vec = new HashMap<String, Integer>();
List<String> transp = Arrays.asList("Car", "Bus", "Train");
List<Integer> amount = Arrays.asList(58, 16, 33);
int val() {
for (int i = 0; i < vec.size(); i++)
vec.put(transp.get(i), amount.get(i));
System.out.println(vec);
Random rand = new Random();
int n = 0 + rand.nextInt(vec.size());
}
}
Thanks!