コード例 #1
0
  /** Not yet commented. */
  public static void test(int weight, int size) {
    WeightedRandomSampler sampler = new WeightedRandomSampler();
    sampler.setWeight(weight);

    org.ihtsdo.cern.colt.list.IntArrayList sample = new org.ihtsdo.cern.colt.list.IntArrayList();
    for (int i = 0; i < size; i++) {
      if (sampler.sampleNextElement()) sample.add(i);
    }

    System.out.println("Sample = " + sample);
  }
コード例 #2
0
 /** Returns a deep copy of the receiver. */
 public Object clone() {
   WeightedRandomSampler copy = (WeightedRandomSampler) super.clone();
   copy.generator = (Uniform) this.generator.clone();
   return copy;
 }