### Question:
MathUtil { public static final <T> Collection<T> randomPickGaussion( Collection<T> collection, int count, double q) { ArrayList<T> list = new ArrayList<T>(count); if (collection == null || collection.size() == 0 || count < 0 || count > collection.size()) { return list; } if (count == collection.size()) { return collection; } else { ArrayList<T> coll = new ArrayList<T>(collection); int low = 0; int high = 0; int number = 0; while (number < count) { high = coll.size(); int index = nextGaussionInt(low, high, q); if (index < high) { T t = coll.remove(index); list.add(t); number++; } } return list; } }  static final double nextDouble(); static final double nextGaussionDouble(); static final double nextGaussionDouble(double u, double q); static final int nextGaussionInt(int low, int high); static final int nextGaussionInt(int low, int high, double q); static final int nextGaussionInt2(int low, int high, double q); static final int nextFakeInt(int max); static final int[] nextPermuate(int n, int k); static final Object[] randomPick(Collection<T> collection,
			int count); static final List<T> randomPickShuffle(Collection<T> collection,
			int count); static final Collection<T> randomPickGaussion(
			Collection<T> collection, int count, double q); static final double solveCubicEquation(double a, double b, double c, double d);  }### Answer:
@Test public void testNextGuassionSampleRatio() throws Exception { ArrayList<Integer> list = new ArrayList<Integer>(); for ( int i = 0; i<10; i++ ) { list.add(i); } int max = 10000; int[] ratio = new int[10]; for (int i = 0; i < max; i++) { Collection<Integer> ints = MathUtil.randomPickGaussion(list, 1, 4.0); int index = ints.iterator().next(); ratio[index]++; } printRatio(ratio, max); }