[抄题]: Given an array w of positive integers, where w[i] describes the weight of index i, write a function pickIndex which randomly picks an index in proportion to its weight. Note: 1 <= w.length <= 10000 1 <= w[i] <= 10^5 pickIndex will be cal
//效率取随机不重复数 public int[] takeRandom(int num) { Random rd = new Random(); int[] rds = new int[num];//随机数数组 List list = new ArrayList();//存放有序数字集合 int index = 0;//随机索引 for (int i = 0; i < num; i++) { list.add(i); } for (int i = 0; i < num; i++) { inde