Code example for Random

Methods: nextDouble

    this.basic = this.rank.getBaseGradient();
  public Vector apply(String groupKey, int actual, Vector instance, AbstractVectorClassifier classifier) {
    if (random.nextDouble() < alpha) {
      // one option is to apply a ranking update relative to our recent history 
      return rank.apply(groupKey, actual, instance, classifier);
    } else { 
      // the other option is a normal update, but we have to update our history on the way 
      rank.addToHistory(actual, instance);
      return basic.apply(groupKey, actual, instance, classifier);